You won’t lose it by doing this, we all do this.. git reset --hard command rolls back to the version number modified by A git pull --rebase origin branch number Pull down the code of B to see if there is any conflict , git push after conflict resolution ..
git reset --soft HEAD@{id}, this will withdraw the submission, but the modifications in the workspace will not disappear, then correct the wrong modifications, submit and push to the remote end
Don’t use git reset,如果有人已经 pull 了这些 commit,会很麻烦 这种情况下应该用 git revert on an already submitted commit on the public branch, it will generate a separate commit
git rebase -i HEAD^^^ 用默认编辑器打开一个文档,修个A那次提交前面改成drop或简写为d Save. The submission will be automatically discarded (if there is a conflict, you have to resolve the conflict yourself)
You can only revert, not reset. Any commit that has been pushed to the remote cannot be reset or commit --amend. This will destroy other people's version history.
For information about revert, you can read this article of mine: /a/11...
git revert (version number)
You won’t lose it by doing this, we all do this..
git reset --hard command rolls back to the version number modified by A
git pull --rebase origin branch number Pull down the code of B to see if there is any conflict , git push after conflict resolution
..
git reset --soft HEAD@{id}, this will withdraw the submission, but the modifications in the workspace will not disappear, then correct the wrong modifications, submit and push to the remote end
In this case, I usually check the log directly and restore file A to ensure that file B is complete
Can’t you just modify the wrong ones and then submit them once to overwrite them?
Don’t use
git reset
,如果有人已经 pull 了这些 commit,会很麻烦这种情况下应该用
git revert
on an already submitted commit on the public branch, it will generate a separate commitgit rebase -i HEAD^^^
用默认编辑器打开一个文档,修个
A
那次提交前面改成drop
或简写为d
Save.The submission will be automatically discarded (if there is a conflict, you have to resolve the conflict yourself)
git log View the commitId of A B before A
git reset --hard A's previous commitId
git cherry-pick B’s commitId
This function is called the checkout function, and you can get the modifications submitted at a certain time
You can only revert, not reset. Any commit that has been pushed to the remote cannot be reset or commit --amend. This will destroy other people's version history.
For information about revert, you can read this article of mine: /a/11...