How to remove Windows GUI Commit ?

Hello,

I use Windows 10 and the latest GitHub Desktop for Windows.

I tried committing a file over 100 MB.  It was a video, that I had forgotten to shrink.

Now I’m stuck. 

I tried reversing commits in Windows GUI.

I’ve uninstalled and reinstalled GitHub desktop.  The commit is still there and stuck.

I’ve installed GIT for the command line.

I try command git log in bash.

$ git log
fatal: not a git repository (or any of the parent directories): .git

I have not idea where this git log is.  I’m a complete Newby and had zero desire to delve into this literature.  But not I have to.

How do I clear out this Commit?

It’s still there because there is the .git folder inside the project. To delete the commit you have to the previous commit. Let’s make this in order…

Command line method

First of all you have to move in the project folder, than open here the git bash command line and type:

git log

If you are in the right folder you see something like this:

commit 25d34209da48d9a5fd0b2540c7f23b25adc402a3
Author: Wabri <gabriele.puliti@gmail.com>
Date: Thu Oct 25 15:40:11 2018 +0200

    update README

commit 116c0167a589021a12b81a3502b58fe99bbab87f
Author: Wabri <gabriele.puliti@gmail.com>
Date: Wed Oct 24 17:15:11 2018 +0200

    update readme and debinstall

commit eb43dd801ed3d58a776c3cbe8eb6c64d5ce92e35
Author: Wabri <gabriele.puliti@gmail.com>
Date: Sun Oct 21 23:30:43 2018 +0200

    Some update

commit dd197684199a69356ff1efdcebffd378291db7ab
Author: Wabri <gabriele.puliti@gmail.com>
Date: Sun Oct 21 23:26:04 2018 +0200

In my case if I want to delete the last commit (if and only if I have not pushed yet), i have to take the token of the previous commit:

commit<u><strong>116c0167a589021a12b81a3502b58fe99bbab87f</strong></u><----------- this one
Author: Wabri <gabriele.puliti@gmail.com>
Date: Wed Oct 24 17:15:11 2018 +0200

    update readme and debinstall

Then move back in time with reset, like this:

git reset --hard 116c0167a589021a12b81a3502b58fe99bbab87f

 

From here you can create a branch or create a new commit to push (if and only if you have not pushed yet).

Github GUI method

Dont really know, i dont use that, sorry

I hope I have solved your problem

-Gabriele-

@gz1968 we are in the process of shipping a feature to warn about committing files over 100MB in GitHub Desktop, which should hopefully prevent these types of issues from occurring in the future. Currently it isn’t possible to remove a large file in GitHub Desktop, but we do have a help article that walks through some of the available options for removing files from your repository’s history. You will need to use the command line for these steps.

If you follow the steps that @wabri shared please note that the --hard flag is destructive in nature – it will delete all of the files in the commit where you committed the large file. I would recommend using the --mixed flag since that will leave your other files untouched in your working directory. You can then right-click on the file in GitHub Desktop and select Discard changes... to delete the specific large file that you created. I hope that is helpful!

2 Likes