0

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

2 Answers2

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.

Florian Lüdiger
  • 168
  • 3
  • 12
  • I already zipped all of my work, so I will always have a backup. Is it safe for me to use git reset HEAD^^, if I have this backup or would you not recommend using this at all? – JustProgrammingQuestions Nov 27 '19 at 09:56
  • 1
    If you have a backup, you can restore that if you want of course so that shouldn't be a problem. (Although this kind of defeats the purpose of git because you usually use git so you do not have to create backups manually.) All I am saying is that using "git reset" can be dangerous sometimes if you don't know what you are doing. The command from my answer will remove your last two commits which should work for you. – Florian Lüdiger Nov 27 '19 at 10:02
  • This resulted into "Commit failed - exit code 128 receiver...". After executing the commands git config --global user.email & git --config user.name, like the error said. I was able to commit changes again. Thanks! – JustProgrammingQuestions Nov 27 '19 at 10:10
0

Click undo button in the lower left corner.

enter image description here

Smart Manoj
  • 5,230
  • 4
  • 34
  • 59