git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* removing files from history but not filesystem
@ 2011-06-28  6:13 Shantanu Pavgi
  2011-06-28  7:04 ` Christof Krüger
  0 siblings, 1 reply; 6+ messages in thread
From: Shantanu Pavgi @ 2011-06-28  6:13 UTC (permalink / raw)
  To: git@vger.kernel.org


Hi,

How do I delete files from commit history, but still keep these files untracked on the filesystem? 

I tried 'git rm --cached' command using 'git filter-branch'; however it deleted file from the filesystem as well. 

{{{
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch */one.txt' HEAD
}}}

I am guessing since file is getting deleted from commit history (where it was created/modified), it won't be present on the filesystem as well. Am I following it correctly? Any further elaboration on this problem will be really helpful. 

Do I need to move concerned files to some other temporary location and rename them back to original filename? I have tried following commands with tree-filter, but it is failing as of now (second mv command needs to know correct filesystem path which was matched for */one.txt): 
{{{
$ git filter-branch -f --tree-filter \
> 'if [ -f */one.txt ]; then mv */one.txt */one.txt.keep; fi; rm -f */one.txt; if [ -f */one.txt.keep ]; then mv -f */one.txt.keep */one.txt; fi' \
> HEAD
}}}
 
Any help?

--
Thanks,
Shantanu. 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-29 21:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-28  6:13 removing files from history but not filesystem Shantanu Pavgi
2011-06-28  7:04 ` Christof Krüger
2011-06-29  4:10   ` Shantanu Pavgi
2011-06-29  6:08     ` Christof Krüger
2011-06-29 16:57       ` Christof Krüger
2011-06-29 21:45       ` Shantanu Pavgi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).