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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2009-02-06, Bisani, Alok <alok.bisani@xxxxxxxxxxxxxxxxx> wrote:

> 	I found a feature that was a bit surprising. Basically, a file
> exist on master as untracked (git-ls-files --others). It is git-add'ed
> on a branch. Now switching back to master, removes the file from
> master's working directory as well.

How would git know that you had such an untracked file in
master?  As far as git knows, at the point you switch back
from branch to master, the file (a) is clean,
exists/committed on branch and (b) does not exist on master.
So it needs to be deleted.

If you really want to do this, you can "git stash" before
switching to the branch and "git stash pop" when you come
back to master.

> 	Is there a way to pull in changes from a branch but only limited
> to a file/files? I ended up doing a manual restore using git-cat-file
><branch>@{0}:/file. And checked in.

git checkout branch -- filename

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux