Remove file from amended commit

前端 未结 4 1695
北恋
北恋 2021-02-14 01:31

I pushed a commit to a repo where I accidentally added a file. Nobody else has merged from the remote repo so I can rewrite history. But when I remove file(unstage, not remove f

4条回答
  •  时光取名叫无心
    2021-02-14 01:52

    If you need to rewrite the full commit, try to use

    git reset HEAD^
    git add 
    # or git add -pu
    git commit -C 
    

    Before doing this you will need to keep the last commit number to able to reuse the commit message/date/author.

提交回复
热议问题