Thread (4 messages) flat view 4 messages, 2 authors, 2016-06-15

Re: git checkout effect on ls-files --others, how to merge partially?

From: Sitaram Chamarty <hidden>
Date: 2016-06-15 22:46:07

On 2009-02-06, Bisani  Alok [off-list ref] wrote:
quoted
git checkout branch -- filename
This is exactly what I was looking for, thank you! I
wonder why it is the checkout command which does this,
rather than the pull/merge. What is the reason that we
cannot pull/merge a specific file from a branch?
Pull is to pull commits between repos, not files between
commits.  (The special case of using "." as the repo is just
that -- a special case; ignore it for now).

Merge is to merge commits within a repo.

Both operate on entire commits, and both *create* a new
commit to record their action (ignore the --no-commit option
in merge for now; that too is a special case IMO, and its
purpose does not detract from the overall sense of what I am
saying anyway)

What you want is an individual file in a commit.  'git show'
is a good way of getting that, as is 'git cat-file blob'
(by the way I prefer 'git cat-file -p').  For blob objects,
all of them seem to do the same thing.

But all of them are geared to putting the file onto stdout,
and you deal with it how you want.  They're all basically
just 'cat', with a couple of extra whiskers perhaps :-)

'git checkout' is meant to 'checkout a branch or paths to
the working tree' -- as it says on the tin, which is what
you want.

Sita
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help