Reverting to a specific commit without losing history

前端 未结 3 1466
孤城傲影
孤城傲影 2021-02-19 07:57

I know this type of a question has a lot duplicates, but I wanted to open a new one because I didn\'t found in all of the other questions the explaination of the best way to do

3条回答
  •  故里飘歌
    2021-02-19 08:21

    Don't revert your changes, just go back to a previous commit and then checkout a new branch from there.

    git checkout development
    git checkout c14809fa
    git checkout -b newBranch
    

    This way you can visit the 'development' branch to see old changes and history and you can make further changes in 'newBranch'

    You can rename the branches if you want the other way around using -

    git branch -m  
    

提交回复
热议问题