Move Old Changes Off Master Branch
This question already has an answer here:
You should use interactive git rebase:
git rebase -i HEAD~3
You will see a list of your 3 commits. Remove the line with the commit that is not needed and save and exit the editor. Git will perform the rebase operation and remove the commit
If you have pushed your chanes to the upstream remote you will need to perform forced push, ie forcefully overwrite the history. Remember though that there is only one rule in Git - do not overwrite published history. This is mostly important when you are collaborating with many people on some project. And in this case if you pushed a buggy commit, i would recommend to either use the
git revert commitID
or just fix the bug and commit the fix on top of the commit3
链接地址: http://www.djcxy.com/p/49786.html下一篇: 移除主分支上的旧更改