How can I fix a reverted git commit?

后端 未结 4 2034
半阙折子戏
半阙折子戏 2021-02-03 18:19

I\'ve committed a bunch of changes to a repository, and they were reverted by someone else (they compile on windows but not on linux). I think that the changes are still in the

4条回答
  •  忘掉有多难
    2021-02-03 18:40

    You can also do like similar situation answer https://stackoverflow.com/a/10415744/704008 from @MarkLongair. Answer is better suited for multiple commits and if you don't want mess in git log or source control history of revert & then again revert of revert.

    git revert abcd123
    git revert --no-commit wxyz789
    git commit --amend -m"you edit commit message"
    

    You can also have concise in one line for two or more revert commits like :

    git revert abcd123 wxyz789 --no-commit 
    git commit --amend -m"you edit commit message"
    

    ... and then write an appropriate commit message describing the combined effect of reverting both commits.

    All this will appear as single commit with given message & not multiple revert commit in git log or above source control logs(like bitbucket/TFS/JIRA git integration).

提交回复
热议问题