Git:删除意外添加到存储库的文件。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git:删除意外添加到存储库的文件。相关的知识,希望对你有一定的参考价值。
Note that you don't actually need a temporary branch, you can do this with a 'detached HEAD', but you need to take a note of the commit id generated by the git commit --amend step to supply to the git rebase command rather than using the temporary branch name.
# create and check out a temporary branch at the location of the bad merge git checkout -b tmpfix <sha1-of-merge> # remove the incorrectly added file git rm somefile.orig # commit the amended merge git commit --amend # go back to the master branch git checkout master # replant the master branch onto the corrected merge git rebase tmpfix # delete the temporary branch git branch -d tmpfix
以上是关于Git:删除意外添加到存储库的文件。的主要内容,如果未能解决你的问题,请参考以下文章