1

This is the first time for me using git (on bitbucket.org - if that makes any difference) and I committed a few audio files to the repo which I obviously don't want there. I added then added the paths to the .gitignore to find out that this will only ignore further changes. So I stumbled upon this SO question and tried to use David Underhill's script that's mentioned there.

However, now I'm getting the following message for git commit:

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 10 and 10 different commits each, respectively.
#
nothing to commit (working directory clean)

and for git push

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://bitbucket.org/abc/def'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

So I tried a git push --force which succeeded but didn't actually change anything in the repo and doesn't even show up there.

Do you know how I could fix this?

Community
  • 1
  • 1
kah
  • 170
  • 1
  • 12

1 Answers1

1

A git filter-branch will rewrite the history of SHA1 of your commits, so the error message makes sense.

If your local repo is on branch master and have those files removes, then git push -f will mirror that on your bitbucket repo.

If it doesn't, it maybe because you are not pushing local master in the first place (try git push -f origin master to be sure).
Ir because you are (locally) in a detached head mode.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250