Skip to content

lab 42 Fetching Changes



cd ../cloned_hello
git fetch
git hist --all

NOTE: Now in the cloned_hello repo


$ git fetch
From /Users/jerrynummi/Projects/git_immersion_edgecase/auto/hello
   c46c56e..76cd598  master     -> origin/master
$ git hist --all
* 76cd598 2018-09-28 | Changed README in original repo (origin/master, origin/HEAD) [Jim Weirich]
* c46c56e 2018-09-28 | Updated Rakefile (HEAD -> master, origin/greet) [Jim Weirich]
* 0ccac93 2018-09-28 | Hello uses Greeter [Jim Weirich]
* a5ff572 2018-09-28 | Added greeter class [Jim Weirich]
* 5c40874 2018-09-28 | Added README [Jim Weirich]
* 191f0c6 2018-09-28 | Added a Rakefile. [Jim Weirich]
* ef98cae 2018-09-28 | Moved hello.rb to lib [Jim Weirich]
* e1e08fd 2018-09-28 | Add an author/email comment [Jim Weirich]
* 7bf0bf1 2018-09-28 | Added a comment (tag: v1) [Jim Weirich]
* 9cf3f21 2018-09-28 | Added a default value (tag: v1-beta) [Jim Weirich]
* 94e1b8b 2018-09-28 | Using ARGV [Jim Weirich]
* f656098 2018-09-28 | 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 “Updated Rakefile” commit. You will see that it 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

We can demonstrate that the cloned README is unchanged.




$ cat README
This is the Hello World example from the git tutorial.

See, no changes.