Convenient for future reference. Thank the original blogger for sharing.
When we develop a project on more than one computer, we need to constantly modify the submission and update the latest remote code on another computer, see how to get updates from the remote code warehouse to the local, summed up the article on the Internet, using the following way is relatively simple.
Viewing remote branches
Use the following command to view the remote repository (I have a origin warehouse here)
1 2 3 |
$ git remote-v origin git@github.com:username/animations. Git (Fetch) Origin git@github.com:username/animations. git (push) |
get the latest version from remote to local
Use the following command to create a new temp branch locally and download the master Branch code of the remote Origin warehouse to the local temp branch
1 2 3 4 5 6 7 8 |
$ GIT fetch origin master:temp remote:counting objects:18, done. Remote:compressing objects:100% (6/6), done. Remote:total (Delta 3), reused 0 (Delta 0) unpacking objects:100% (11/11), done. From Github.com:username/animations * [New branch] Master, temp c07bdc7. 40f902d Master--Origin/master |
Compare the local warehouse with the downloaded temp branch
Use the following command to compare the differences between the local code and the code just downloaded from the remote: