Reputation: 40041
I have a local branch with a couple of commits. Now I need to rewrite all of those commits and change a file name but only in one specific directory. I don't want any changes to commits not on my local branch.
Running git filter-branch 'some command' master..HEAD
standing in that directory gives me
You need to run this command from the toplevel of the working tree.
Of course I can run this from the top level but that would force me to write my script with the path of the directory I really want to change and eventually I would like to run the same script in a couple of directories without really knowing what there full path is.
Is there a way to run filter-branch and have the script have the current directory as it's working directory?
Upvotes: 4
Views: 2370
Reputation: 70783
No, there is not. But just make your script take a parameter and then run this in your toplevel:
git filter-branch 'yourscript the/sub/directory' master..HEAD
Upvotes: 3