1

I commit the file vie IntelliJ. But I didn't push.

How Can I remove this commit? I am new to GIT so pls clarify.

I checked other questions, it says only about commit. Not sure whether they pushed or not.

ever alian
  • 1,028
  • 3
  • 15
  • 45
  • 1
    Possible duplicate of [How do you undo the last commit?](http://stackoverflow.com/questions/927358/how-do-you-undo-the-last-commit) – Brian Cain Nov 17 '15 at 03:53

1 Answers1

6

Committing and pushing are two separate operations. Since you created a commit using IntelliJ it means you have one commit. Now when you push, git tries to push all your commits(in this case 1 commit) to remote. Since you haven't pushed you are just left with the Intellij created commit. so removing the commit is just an other operation.

git reset HEAD~1 

should leave your original changes. For more info on undoing things check 12th slide in this presentation on Git http://vineelkumarreddy.com/index.php/2015/08/01/git-talk/

Hope this helps you :)

Vineel
  • 1,430
  • 14
  • 18