Re: history missing
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Nov 8, 2010, 09:02 UTC
- Message-ID
- <20101108090230.GC2430@burratino>
- In-Reply-To
- <AANLkTikFB5HNOmg0iTdjHxtrhU9vdua5O8btgFzpg-2F@mail.gmail.com>
Hi Vitaliy,
Vitaliy Semochkin wrote:
Show 6 quoted lines
> I cloned a remote repository > to check recent changes in origin/master I do: > git fetch origin master > git log origin master > > recently I found out that log doesn't show recent commits
Yes, this can be confusing.
The "git fetch" command can be used in two ways: to update remote-tracking branches and to grab some particular branch (or other ref) quickly.
Updating remote-tracking branches ---------------------------------
Use "git fetch <remote>", or "git fetch --all" if you want to update all remote-tracking branches.
Inspecting a particular branch ------------------------------
Use "git fetch <remote> <branch>"; this will fetch that branch and store it as FETCH_HEAD. You can "git log FETCH_HEAD", "git merge FETCH_HEAD", etc, to interact with the branch head you just downloaded.
If you want to fetch a branch to a local branch, you could use
git fetch <remote> <branch> git branch <local-branch-name> FETCH_HEAD
but there is also a shorter way to write that:
git fetch <remote> <branch>:<local-branch-name>
This form is especially useful for grabbing a subtree of the branch hierarchy all at once:
git fetch junio refs/heads/sg/*:gabor/*
The "git fetch <remote>" form is syntactic sugar for this syntax. The 'fetch' lines in .git/config describe what remote:local ref specifiers will be implicitly added to the command line after the name of a configured remote repository.
See the "git fetch" manual for details and examples.
Hope that helps, Jonathan