lab 42 Fetching Changes



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

NOTE: Now in the cloned_hello repo


$ git fetch
From /Users/jim/src/git_immersion/auto/hello
   b818028..a5aa8e7  master     -> origin/master
$ git hist --all
* a5aa8e7 2014-10-25 | Changed README in original repo (origin/master, origin/HEAD) [Jim Weirich]
* b818028 2014-10-25 | Updated Rakefile (HEAD, origin/greet, master) [Jim Weirich]
* b790264 2014-10-25 | Hello uses Greeter [Jim Weirich]
* 0a576ce 2014-10-25 | Added greeter class [Jim Weirich]
* 6fd9eff 2014-10-25 | Added README [Jim Weirich]
* 14ba469 2014-10-25 | Added a Rakefile. [Jim Weirich]
* 4b249b3 2014-10-25 | Moved hello.rb to lib [Jim Weirich]
* bfd1408 2014-10-25 | Add an author/email comment [Jim Weirich]
* a1189df 2014-10-25 | Added a comment (tag: v1) [Jim Weirich]
* 6083cb8 2014-10-25 | Added a default value (tag: v1-beta) [Jim Weirich]
* b24f3ff 2014-10-25 | Using ARGV [Jim Weirich]
* cf466b4 2014-10-25 | 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 01

We can demonstrate that the cloned README is unchanged.




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

See, no changes.

Table of Contents