lab 42 Fetching Changes

Goals

Execute:

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

NOTE: Now in the cloned_hello repo

Output:

$ git fetch
From /Users/ismail/sandbox/repos_own/git-labs/auto/hello
   d15df76..d5442f3  master     -> origin/master
$ git hist --all
* d5442f3 2013-10-06 | Changed README in original repo (origin/master, origin/HEAD) [Ismail Dhorat]
* d15df76 2013-10-06 | Updated Rakefile (HEAD, origin/greet, master) [Ismail Dhorat]
* 2fda7cb 2013-10-06 | Hello uses Greeter [Ismail Dhorat]
* 343d947 2013-10-06 | Added greeter class [Ismail Dhorat]
* 313c04d 2013-10-06 | Added README [Ismail Dhorat]
* b3e19a3 2013-10-06 | Added a Rakefile. [Ismail Dhorat]
* 14f09c0 2013-10-06 | Moved hello.rb to lib [Ismail Dhorat]
* 1fed2ec 2013-10-06 | Add an author/email comment [Ismail Dhorat]
* dc44f2e 2013-10-06 | Added a comment (v1) [Ismail Dhorat]
* 5ec54fd 2013-10-06 | Added a default value (v1-beta) [Ismail Dhorat]
* e606a20 2013-10-06 | Using ARGV [Ismail Dhorat]
* 5d95e74 2013-10-06 | First Commit [Ismail Dhorat]

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.

Execute:

cat README

Output:

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

See, no changes.

Table of Contents