美文网首页Git
Git rebase & Git rebase undo

Git rebase & Git rebase undo

作者: JaedenKil | 来源:发表于2018-01-17 15:44 被阅读13次

    git rebase is basically git merge, but in a different way.
    From a repo, I :

    • create a branch issue_adjust_threshold
    • adjust the threshold
    • make a commit Adjust the threshold
    • push to remote with git push --set-upstream origin issue_adjust_threshold
    • make a pull request

    But on PR page it tells me there is a conflict . So I check the commit history and find out the other case owner has made two commits to master branch. I need to do git rebase.

    • git checkout master, checkout to master branch
    • git pull, update master branch
    • git checkout issue_adjust_threshold, checkout to issue_adjust_threshold branch
    • git rebase -i master, rebase master to issue_adjust_threshold
    • git tells there are conflicts with a file xxx/MainTest.java
    • fix the conflict, git add xxx/MainTest.java
    • git commit -m "Adjust the threshold"
    • git push -f

    If some rebase doesn't work well, this can undo it:

    git reflog 
    git reset --hard HEAD@{n}
    

    Refer to:rebase 01, rebase 02, resolve conflict 01, resolve conflict 02, resolve conflict 03, undo rebase.

    相关文章

      网友评论

        本文标题:Git rebase & Git rebase undo

        本文链接:https://www.haomeiwen.com/subject/exkuoxtx.html