There has certainly been posts around for this, but I actually did a commit because I thought it was the right thing to do.
So, I have two repositories, one development and one production. I had to edit something in the production because it was an urgent bugfix, and now I have three files that are newer in the production than in the development.
I committed the three files on the production and tried a pull, but it told me there were merge errors. I tried copying and pasting the new files to the development server and retrying the whole thing and it didn't work. Now I'm sure that what I need is on the development (since I copied and pasted into it) and committed, so how could I pull and overwrite the conflicting files?
---- Following up to @Seths reply
Ok, I guess I do need to reword my question :)
I have three repositories. One development, one in GitHub and one production.
Usually to update production I just do a push from development to GitHub, git pull origin master
(from GitHub to production), and it works.
Unfortunately, I changed files on production without stashing. How do I force overwrite instead of merge when trying a pull?
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content.
If you want to entirely replace your local branch foo with the contents of the remote branch origin/foo:
git fetch origin
git checkout foo
git reset --hard origin/foo
If you want to do something else, please reword your question. However, I might add the production Git repository as a remote and then merge the live changes in, instead of whatever you tried.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With