lab 23 Fetching Changes
Goals
- Learn how to pull changes from a remote repository.
Execute:
cd ../cloned_hello git fetch git hist --all
NOTE: Now in the cloned_hello repo
Output:
$ git fetch remote: Counting objects: 3, done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From /home/fourey/Ens/Cours/Git/TP/gitimmersion/resources/gitimmersion/shared_hello 9571909..ff00176 master -> origin/master $ git hist --all * ff00176 2015-09-30 | Changed README in original repo (origin/master, origin/HEAD) [Jim Weirich] | * 127103f 2015-09-30 | Merged master fixed conflict. (origin/greet) [Jim Weirich] | |\ | |/ |/| * | 9571909 2015-09-30 | Made interactive (HEAD -> master) [Jim Weirich] | * cd62c7f 2015-09-30 | Merge branch 'master' into greet [Jim Weirich] | |\ | |/ |/| * | b20c6a6 2015-09-30 | Added README [Jim Weirich] | * 9db9ffa 2015-09-30 | Hello uses greet function [Jim Weirich] | * 230a5b8 2015-09-30 | Added greeter function [Jim Weirich] |/ * 913eb69 2015-09-30 | Using argv [Jim Weirich] * c4de4c4 2015-09-30 | First commit [Jim Weirich] $
At this point the repository has all the commits from the original repository, but they are not integrated into the the cloned repository’s local branches.
Find the “Changed README in original repo” commit in the history above. Notice that the commit includes “origin/master” and “origin/HEAD”.
Now look at the “Made interactive” commit. You will see that the local master branch points to this commit, not to the new commit that we just fetched.
The upshot of this is that the “git fetch” command will fetch new commits from the remote repository, but it will not merge these commits into the local branches.
Check the README 01
We can demonstrate that the cloned README is unchanged.
Execute:
cat README
Output:
$ cat README This is the Hello World example from the git tutorial.
See, no changes.