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

git checkout -f branch doesn't remove extra files

From: "Luck, Tony" <tony.luck@intel.com>
Date: 2016-06-15 22:42:03

I've just got around to noticing some of the new (to
me) features in git, and started experimenting with
branches.

I see that when I switch view to a different
branch with:

	$ git checkout -f someoldbranch

that any files that exist in my previous branch view
but not in "someoldbranch" are not deleted.  I can
find and remove them easily with:

	$ git-ls-files --others | xargs rm -f

but I wondered whether this was a deliberate choice
(to avoid clobbering .o files etc. for people who
have run a make in their tree).

Currently git-ls-files doesn't have a way to specify
a branch ... but it it did, the something like:

	comm -1 <(git-ls-files -b oldbranch) \
		  <(git-ls-files -b newbranch) | xargs rm -f

would clean up the spurious files.

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