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
   8db103d..2844f81  master     -> origin/master
$ git hist --all
* 2844f81 2013-10-06 | Changed README in original repo (origin/master, origin/HEAD) [Ismail Dhorat]
* 8db103d 2013-10-06 | Updated Rakefile (HEAD, origin/greet, master) [Ismail Dhorat]
* 30ae4be 2013-10-06 | Hello uses Greeter [Ismail Dhorat]
* 8da6cc5 2013-10-06 | Added greeter class [Ismail Dhorat]
* cad8e98 2013-10-06 | Added README [Ismail Dhorat]
* 27b8b27 2013-10-06 | Added a Rakefile. [Ismail Dhorat]
* 23944f0 2013-10-06 | Moved hello.rb to lib [Ismail Dhorat]
* 273edac 2013-10-06 | Add an author/email comment [Ismail Dhorat]
* 9efd33e 2013-10-06 | Added a comment (v1) [Ismail Dhorat]
* 8b9a1c6 2013-10-06 | Added a default value (v1-beta) [Ismail Dhorat]
* f6f4d6b 2013-10-06 | Using ARGV [Ismail Dhorat]
* f98d857 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