Skip to main content

How to undo an accidental git merge that has not been pushed to GitHub yet?



There are several ways to do this. You can try out one of the following commands.

1.
git reset --hard <commit_sha>
Check git log to find the commit_sha for the command above.

2.
git reset --hard HEAD~5
Five here is the number of commits that you need to get back.

3.
git reset --hard ORIG_HEAD
 ORIG_HEAD will point to a commit directly before merge has occurred. You don't need to find for the commit_sha.

Cheers. :)


Comments

Post a Comment

Popular posts from this blog

How to import the Public Certificate of one WSO2 product to the trust store of another?

To demonstrate this point, I will use the 2 products WSO2 API Manager 2.1.0 (referred as APIM from here onwards) and WSO2 Enterprise Integrator 6.1.1 (referred as EI from here onwards). When using EI as the Business Process Server during configuration of Workflows in APIM, one step to perform is to import the public certificate of EI to the truststore of APIM [1]. So now let's see how this can be done. Step 1: Go to <EI_HOME>/repository/resources/security/ folder and execute the following keytool command. This command is used to export the public certificate of EI as a certificate file called wso2carbon.cer. Since the default keystore in EI is wso2carbon.jks, we have specified it as the keystore and the default alias is wso2carbon. Provide wso2carbon as the keystore password when prompted as it is the default password. After executing the above command from within the security folder in EI, you will see that a file with the name of wso2carbon.cer is created...