On Thu, Aug 13, 2009 at 7:06 AM, Jeenu<[email protected]> wrote:
> Git doesn't warn, by the way; instead, it just removes the file if I
> checkout a branch where the file is not tracked (master), from one
> where it's tracked (foo).
>
> One option that I see is to merge foo to master, so that files that
> are tracked on foo, but are untracked on master, become tracked on the
> latter.

At which point git will complain that "untracked file foo will be
overwritten by merge" :-)

Sorry, you can't win this one.

As tekkub said, it's not a good idea for files to be tracked in one
branch, and untracked in another.

What the original poster really wants to do is to pretend all
untracked files are also tracked but not actually track them; sort of
"have your cake and eat it too".

You can do convoluted things like this:

(before switching away from master)
GIT_INDEX_FILE=.git/master-index git add -A

(then you git checkout otherbranch; git add/commit some of the
untracked files, then come back to master to find that the untracked
files are gone, and you need to get them back)

GIT_INDEX_FILE=.git/master-index git checkout -- .

Probably the simplest way, if you *have* to do this, is to use
"git-new-workdir" from contrib and just work each branch in its own
work tree.  Haven't tried it, but should be a lot easier

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GitHub" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/github?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to