Re: bug? - git-checkout treeish paths ignores deleted files
- From
Wincent Colaiuta <win@wincent.com>
- Date
- Oct 9, 2007, 01:52 UTC
- Message-ID
- <3B0685AB-0725-4473-8AE6-359F93851C10@wincent.com>
- In-Reply-To
- <470AD21E.6070906@gmail.com>
El 9/10/2007, a las 2:58, Mark Levedahl escribió:
Show 23 quoted lines
> Shouldn't "git checkout topic path" make the directory tree > rooted at path identical to what is on branch topic? It doesn't. > > Try this: > > mkdir test > cd test > git init > touch a b > git add a b > git commit -m 'base' > git checkout -b topic > git rm a > git commit -m 'removed a' > git checkout master > git checkout topic . > > ...and the result is... > ls > a b > > instead of > b
No, the behaviour is correct.
- first you removed the file on the topic branch; at the same time you removed it from your working tree - then you switched back to the master branch and so the file was added back to your working tree - then you switched back to the topic branch, and seeing as the file "a" is not being tracked in the topic branch Git doesn't touch it
In general, Git only meddles with stuff that you've told it to track. This is actually a good thing in most cases because it makes some workflows involving dirty trees or trees with untracked content somewhat more convenient.
Cheers, Wincent