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

Re: removing files from history but not filesystem

From: Christof Krüger <hidden>
Date: 2016-06-15 22:51:31

Hi,
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch
*/one.txt' HEAD
The following should work:

git branch temp
git filter-branch --index-filter 'git rm --cached --ignore-unmatch foo' temp
git reset temp

This creates branch "temp" pointing to the same commit as "master".
Then you filter-branch the "temp" branch. This leaves file "foo" in your
working directory intact, as your current branch is actually "master". The
third step resets your current "branch" to the commit pointed by the
rewritten branch "temp". The default for git reset is --mixed which
according to the man page leaves the working tree alone.

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