On Wed, Nov 2, 2011 at 07:40, tombert <tomb...@live.at> wrote:

> "git fetch" updates your local database, but the "local database" is
> not the same as in svn or cvs. In git you have a local and a remote
> database and neither the local nor remote database does/needs not
> contain any files you work on (the remote database is mostly a "bare"
> database) - you have to checkout from that local database first to
> access your files.
>

I think introducing the term "database" just makes this more complicated
than it needs to be, if you remember a few basics about git.

In git, there are local and remote branches. A local branch is created by
doing something like `git branch` or `git checkout -b`. You can checkout
local branches. Remote branches are in some sense references to branches
which are local to some other machine. So "master" is your local branch,
and "origin/master" is a reference to the "master" branch on "origin".

In this situation, a subset of the history might look something like

o (master, origin/master) | o | o

Suppose you know that a file on origin/master has been updated, and you
want to update only that file in your checkout. A `git fetch origin` looks
to see if origin/master points to a new commit, and if it does, any unseen
commits (and other objects), are downloaded from the "origin" remote. With
just `fetch`, there is no merge into your local "master" branch. So that
after the fetch, the history might look like

o (origin/master) | o (master) | o | o

With the working copy left untouched, and the current checked-out branch
being "master". `git checkout <commit> -- <file>` checks out only <file>
from <commit>. So `git checkout origin/master -- file` looks to
"origin/master", which is just a reference to some commit, and gets the
given file and updates the working copy.

Hopefully that gives you some insight into what's going on. It helps to
have a few of the basics of git down, such as the model you're working in.
Git is not SVN!

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to