git rebase - Rename directory throughout Git commit history -


i'm trying rename directory introduced 6 commits ago , in subsequent commits. these commits have not been pushed.

what have tried?

  • i've tried using git filter-branch mv old new command, fails on commits before head~6 because directory doesn't exist.
  • i've tried git rebase -i head~6, editing each commit, can't use mv old new because git's locking file, nor can rename in windows explorer.
  • i've tried same rebase cp -r old new; rm -rf old; git add new creates merge conflicts on head~4 , above.

it may worth noting commit on directory introduced first commit in branch (the branch 6 commits ahead of master) , haven't touched master since branched out.

i've read this question.

what's best way this?

git filter-branch should work fine; make mv command fail gracefully appending || true. example, rename baz/ foo/bar/baz/:

git filter-branch --force --tree-filter \     'mkdir -p foo/bar; mv baz foo/bar/ || true' \     --tag-name-filter cat -- --all 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -