Here is the scenario:
1) My project partner and I were working on a Ruby on Rails app together using github as our code repo.
2) The app is under her github account and she had added me as a collaborator
3) She deployed to Heroku and added me as a collaborator there as well
4) I used the following command from my existing app directory with the intention of adding the existing Heroku remote app as a remote to my existing local app. My existing local app, as I mentioned before, already had a remote github
git remote add heroku [email protected]:codefellow.git
5) I made some changes and pushed them to github and all was up to date
6) Then I attempted to push to heroku with the following command
git push heroku master
7) This gave me an error saying the tip of my branch was behind, as shown below, but when I tried to pull from github, it said I was up to date, as also shown below
➜ code-fellows-alumni git:(master) git push heroku master
To [email protected]:codefellow.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:codefellow.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
➜ code-fellows-alumni git:(master) git pull
Already up-to-date.
So does anyone know what is going on here? How could my local branch be out of sync with Heroku if I'm up to date with Github? Would it have been possible for my project partner to have pushed changes to Heroku without having pushed them to Github first? I checked and she does not have a fork of the application. I cannot get in touch with her at the moment to find out for sure what she might have done--I'm not even sure it would allow her to push changes to Heroku if they hadn't been pushed to Github yet. Any insights would be much appreciated. I don't want to clone the app from Heroku necessarily because I already have it locally synced with Github. I want to use Github as the code repository and I am reluctant to start from a clone from Heroku. I've already looked at the Heroku documentation on this: https://devcenter.heroku.com/articles/git. It just says to do a clone but I don't want to do that for the aforementioned reasons. I followed the directions given in the answer to this question (How to link a folder with an existing Heroku app) to get this far but it seems like there is a missing piece or else my project partner has done something unusual. Thanks in advance for any helpful ideas you might have.
git pull heroku master
and then try to push again after removing the conflicts – Sagar.Patil