Git rollback merge

The merge operation is often rolled back when branch merge errors occur. This article introduces the rollback method of merge.

The command

  1. git reflog: Displays the version number of the last committed record for the merge operation
  2. Git reset -- Hard version number: This allows you to roll back to the state before merge

The sample

Merge dev into master branch by mistake

  1. First of all git reflog

    Ee0ee93 HEAD@{0}: merge dev: merge made by the 'recursive' strategy. 7335548 HEAD@{1}: checkout: moving from dev to masterCopy the code

    You can see that you need to roll back to the commit record 7335548.

  2. Git reset –hard 7335548

     7335548 HEAD@{0}: reset: moving to 7335548
     ee0ee93 HEAD@{1}: merge dev: Merge made by the ‘recursive’ strategy.
    Copy the code

Git setup proxy

Set the agent

Git config http.proxy http://127.0.0.1:7892 git config http.proxy http://127.0.0.1:7892Copy the code

Cancel the agent

git config  --unset http.proxy

git config  --unset https.proxy
Copy the code

Git config –global XXX