Skip to content

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/jerrynummi/Projects/git-immersion-edgecase/auto/hello
   ff7c118..2eece92  master     -> origin/master
$ git hist --all
* 2eece92 2019-11-01 | Changed README in original repo (origin/master, origin/HEAD) [Jim Weirich]
* ff7c118 2019-11-01 | Updated Rakefile (HEAD -> master, origin/greet) [Jim Weirich]
* 2a262be 2019-11-01 | Hello uses Greeter [Jim Weirich]
* 413c34f 2019-11-01 | Added greeter class [Jim Weirich]
* 099ccd0 2019-11-01 | Added README [Jim Weirich]
* ed35144 2019-11-01 | Added a Rakefile. [Jim Weirich]
* 4421854 2019-11-01 | Moved hello.rb to lib [Jim Weirich]
* 185fc95 2019-11-01 | Add an author/email comment [Jim Weirich]
* 4d578d4 2019-11-01 | Added a comment (tag: v1) [Jim Weirich]
* dc1d42f 2019-11-01 | Added a default value (tag: v1-beta) [Jim Weirich]
* 9a1c494 2019-11-01 | Using ARGV [Jim Weirich]
* 063b40e 2019-11-01 | First Commit [Jim Weirich]

At this point the repository has all the commits from the original repository, but they are not integrated into 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 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.

Execute:

cat README

Output:

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

See, no changes.