From: Luck, Tony Date: Fri, 12 Aug 2005 17:31:17 GMT Subject: git checkout -f branch doesn't remove extra files Message-ID: 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