I am currently working on a project and using machines in two different locations to do it. I have created a branch for the feature I am working on and when I finish some work on it I amend my commit to that branch and push it to the server so I can pick up where I left off on my other machine.
When I try to send my amended commit it rejects my push. I assume this is because I am pushing up a commit that is intended to clobber the current HEAD of the feature branch. I typically just use --force.
Is there a better way to do this?
mike@sleepycat:~/projects/myproject$ git pull origin topx
From heroku.com:myproject
* branch topx -> FETCH_HEAD
Already up-to-date.
mike@sleepycat:~/projects/myproject$ git add app/models/reward.rb
mike@sleepycat:~/projects/myproject$ git commit --amend
[topx 82a9880] Added topX reward
9 files changed, 106 insertions(+), 21 deletions(-)
rewrite app/views/ceo/_reward_criteria.html.erb (96%)
create mode 100644 public/javascripts/jquery.multiselect.min.js
create mode 100644 public/site/javascripts/jquery.multiselect.min.js
create mode 100644 public/stylesheets/jquery.multiselect.css
mike@sleepycat:~/projects/myproject$ git push origin topx
To [email protected]:myproject.git
! [rejected] topx -> topx (non-fast-forward)
error: failed to push some refs to '[email protected]:myproject.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.