Re: removing files from history but not filesystem

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

 



On Jun 28, 2011, at 2:04 AM, Christof Krüger wrote:

> 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.
> 

Thanks for the reply Chris. It worked for me. I am not following last command "git reset <branch-name>" though. I have used SHA1 commit object names in 'git reset' command, but I am not sure how <commit> is using branch name here. Is  it because branch is a commit pointer in the git history? 

Also, how do I specify rev-list HEAD-1 so that 'git rm' will be run on all commits excepts latest commit? Following didn't work for me, so I guess I am not following syntax here.  
{{{
$ git filter-branch --index-filter 'git rm --cached --ignore-unmatch apple' HEAD~1
Which ref do you want to rewrite?
}}}


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]