1

So I have my git repository for a project I am working on.

I set up the settings.py file for the first commit like how I wanted it on the server and then I ran git update-index --assume-unchanged mysite/settings.py as I didnt want any changes to be pushed to the server, as the settings are different for production. Now, I wanted to add some new settings, so I added them in my browser, saved them, and git pulled them onto my server.

Now when I am trying to push new code from my laptop I get this error:

To https://github.com/badger1661/smart-survey.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/badger1661/smart-survey.git'
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.

How can I fix this. I want to keep the changes to the settings I made on github, but dont want them on my laptop.

wtreston
  • 1,051
  • 12
  • 28
  • first stash your changes, pull the code, unstash changes, commit, push, boom. Done. – Ankush Rathi Feb 13 '18 at 11:24
  • What does stash and unstash do? I dont want to pull the changes in settings.py from github onto my laptop, as this would change the settings, which are different. @AnkushRathi – wtreston Feb 13 '18 at 11:27
  • If your settings are different in prod and development, consider using a `.gitignore` file to ignore your (dev) settings entirely. – Tom Dalton Feb 13 '18 at 11:31

0 Answers0