I made fixes and tests, git commit -a
, updated my branches and now I'm trying to push to a GitHub fork I had previously made:
vagrant@rails-dev-box:~/rails$ git push mine my_fix
Username for 'https://github.com': myusername
Password for 'https://myusername@github.com':
To https://github.com/myusername/rails.git
! [rejected] my_fix -> my_fix (non-fast-forward)
error: failed to push some refs to 'https://github.com/myusername/rails.git'
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.
I'm guessing the reason for this issue is the fork is a little outdated (by a week maybe). I've made other pushes to the fork though that I don't want to lose. What do I do here?
While on a master
branch locally:
git remote add upstream git://github.com/rails/rails.git
git pull --rebase upstream master
git push --force origin master