removing files from history but not filesystem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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. 

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]