Git Sophisticated Commands

    1. Compare two branches: branch_1 and branch_2:
      git diff branch_1…branch_2
    2. Merge specified files of one branch(e.g. branch_name) into current branch:
      git checkout branch_name ./src/…/file1 ./src/…/file2 ./src/…/file3
    3. Change the committed comments:
      git commit --amend
      
    4. Reset and delete the remote URL:

      git remote set-url origin git://new.url.here
      git remote remove origin
    5. Clone a single branch:

      git clone -b <branch> <remote_repo>
      git clone -b my-branch git@github.com:user/myproject.git
    6. Ignore history after one commit and preserve changes locally:

      git reset <commit>
      
原文地址:https://www.cnblogs.com/kid551/p/4846457.html