'GitHub Desktop remove last two commits

I made a git using GitHub Desktop. It has the master branch and a development branch. In the development branch I accidentally added a library that was over 100mb. Now I can't push it anymore. I tried to push another commit, but that one is blocked as well.

I already downloaded git for the cmd, but github desktop gives an error whenever I try to open it in the cmd.

We were unable to locate Git on your system. This means you won't be able to execute any Git commands in the command prompt.

To help you get Git installed and configured for your operating system, we have some external resources available.

Does anyone know how I can fix this issue without the cmd or how I can open/clone the branch using the cmd?



Solution 1:[1]

Try to open a new terminal window and use git from there. I assume that you are on windows so maybe this will help you.

  1. Open a new terminal window and navigate to your project directory.
  2. Type "git status" to check, if git has been installed correctly. If not, try to restart your system or reinstall git.
  3. Type "git reset HEAD^^". This will remove your last two commits (as you requested in your question title)
  4. After that you should be able to push again (e.g. "git push")

Be careful with the "git reset" command as it could delete unsaved work of yours. I suggesst that you read the documentation before using it carelessly.

Solution 2:[2]

Click undo button in the lower left corner.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Florian Lüdiger
Solution 2 Smart Manoj