Question

I have followed this answer (How to remove/delete a large file from commit history in Git repository?) to get rid of some big, unwanted files in a repository. I have done all the steps stated there in my local copy (because trying to do it in the bare, original, repository results in an error as long as it does not have a working tree). Nevertheless, when I finish the steps (having removed the files, etc.) and I do a "git status" on my local copy, I get

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 16 and 18 different commit(s) each, respectively.

and I do not know how to send the changes back to the central repository. Can anybody help me?

Was it helpful?

Solution

Since you have change the history of your commits, you would have to force push them back to origin:

git push --force

This is dangerous and disruptive. Make sure to communicate that event (before pushing) to anyone having already pulled from your repo: they will need to reset their master branch to the one you just pushed:

git checkout master
git fetch
git reset --hard origin/master
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top