Rename file for all commits in git repository

前端 未结 2 435
小鲜肉
小鲜肉 2020-12-30 01:07

I want to rename a file for all the commits in git repository, here\'s what I have tried:

git filter-branch --index-filter \'git mv -k  

        
相关标签:
2条回答
  • 2020-12-30 01:21

    I finally solved my original problem by using:

    git filter-branch --tree-filter '
    if [ -f <old name> ]; then
      mv <old name> <new name>
    fi' --force HEAD
    
    0 讨论(0)
  • 2020-12-30 01:27

    For anyone interested in just renaming a file - git rebase -i will work just fine - include the commit that created the file in the rebase, mark it with edit and just rename the file, git will apply the next commits to this file correctly.

    0 讨论(0)
提交回复
热议问题