How to discard local commits in Git?

后端 未结 6 1113
忘掉有多难
忘掉有多难 2020-12-04 04:44

I\'d been working on something, and decided it was completely screwed...after having committed some of it. So I tried the following sequence:

git reset --har         


        
6条回答
  •  萌比男神i
    2020-12-04 05:15

    What I do is I try to reset hard to HEAD. This will wipe out all the local commits:

    git reset --hard HEAD^
    

提交回复
热议问题