I am a relatively new developer. I recently made an application and deployed it using Heroku. It had some bugs, so I fixed them up. Yesterday I entered the usual commands in the terminal; namely git add .
, git commit -m "Fixed some bugs"
, and git push heroku master
. When I entered the last command, it gave an error saying
Error: failed to push some refs to '<someUr>l'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I searched for this error and found that this problem here was similar. So I did what the answers said; git pull
, and git pull heroku master
. I would have done these five commands a few times in some order (sorry for the unclearness of the question, this happened yesterday). Then when I once did git push heroku master
, it didn't give any errors. So I headed over to my site and it gave me an application error. When I went back and checked my files, I found that they had been modified.
Somehow, >>>>>>>HEAD
and a few equal signs and another strange combination which looked like a hash were all around the files. Other than that, it seemed to have added some of my previous code which I had removed.
This was a disaster. At the end, I entered git diff
in the terminal and modified 200 lines of code to their previous state checking the differences in the terminal.
Now, after spending some good time, I have deployed it successfully. I want to know what caused this and how to solve it if it happens again. Thanks in advance.