Throw away local commits in Git

前端 未结 20 1689
遥遥无期
遥遥无期 2020-12-02 03:08

Due to some bad cherry-picking, my local Git repository is currently five commits ahead of the origin, and not in a good state. I want to get rid of all these commits and st

20条回答
  •  遥遥无期
    2020-12-02 03:42

    git reset --hard 
    

    This will come in handy if you have made some mistakes on your local copy that you want to make sure doesn't get pushed to your remote branch by mistake.

    The SHA-Code can be obtained by looking at webVersion of your git dashboard for the last commit on the branch.

    This way you can get synchronized with the last commit on the branch.

    You can do git pull after you have successfully completed the hard reset to confirm nothing new to syn i.e. you get to see the message.

    Your branch is up to date with Origin/

提交回复
热议问题