Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save baaixw/769c47a808858d8d9e3d1a1ef782e30c to your computer and use it in GitHub Desktop.
Save baaixw/769c47a808858d8d9e3d1a1ef782e30c to your computer and use it in GitHub Desktop.

Problem statement

Did some data analysis which resulted in generating a huge data file, greater than 100 MB. Accidentaly, tried to push it to Github and the nightmares began! Keep getting error messages, cant push because large files detected.

Solution

The following solution worked for me;

  1. Open command shell in the repo
  2. type, git status
  3. After this, you should see something along the lines of

`On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits)

nothing to commit, working tree clean`

The important part is the "2 commits"! From here, go ahead and type in:

git reset HEAD~<HOWEVER MANY COMMITS YOU WERE BEHIND>

So, for the example above, one would type:

git reset HEAD~2

After you typed that, your "git status" should say:

On branch master Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Now, you can push the commit again. Yay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment