Ever tried to push your file changes to a git repository and get the failed to push some refs error?
Did you pull from the branch already to get the latest changes?
As in: Did something change on the remote or did you rewrite git history locally?
You might think, "Since I'm the only one making changes to the branch, why would I need to do a git pull?"
Maybe you’ve accepted some suggestions from code review? Those count as commits as well.
Or you clicked the button that pulls in master.
If so, your branch is no longer directly based off of the branch you're trying to merge it into.
You can rebase your branch on top of the destination branch (git rebase
git push
Here's an example of a time when I tried to push my local index to a github repository:
When I say "git index" I'm talking about the files I changed, added and committed to my local git repository.
The changed files are in git's local staging area, also known as "the git index".
Same Error
I followed the instructions and did a git pull and then a git push again.
Same error.
Did you change your history locally?
As in: If you did a rebase or git commit --amend or similar locally your repo can get into a state like that. In this case, you need to force push.
Ends up I modified a file on github.com and when I saved it, it got "auto-merged"
git pull origin show-recent-tagged-pkg-versions --rebase might do the trick
This work is licensed under the Creative Commons Attribution 3.0 Unported License.
Same error.
The fix
Did you change your history locally?
As in: If you did a rebase or git commit --amend or similar locally your repo can get into a state like that. In this case, you need to force push.
Ends up I modified a file on github.com and when I saved it, it got "auto-merged"
git pull origin show-recent-tagged-pkg-versions --rebase might do the trick
This work is licensed under the Creative Commons Attribution 3.0 Unported License.