I have a problem where my master changes are completely overwriting my changes in a development branch, instead of merging them.
I have a master and a development branch for a web application. I am currently working on features that will take a few weeks to implement, but at the same time other developers are continuously adding to master.
Let me use one file as an example, functions.php
I am making many lines of changes in the functions.php
file within the dev
branch.
Occasionally I switch to master using git checkout master
and pull from the online using git pull origin master
. This brings the team changes inline with my local dev.
Now, I want to introduce those changes into my functions.php
file in dev
branch while maintaining my work I have done thus far. So I checkout the dev
branch and I run git merge master
. The thing is, the functions file in master
branch is COMPLETELY overwriting my functions file in dev
branch.
Why?
To summarize my workflow:
git checkout master # Move to master branch
git pull origin master # Get down local changes, all along I have been working in dev and making dev progress
git checkout dev # move to dev branch
git merge master # attempt to align team changes to my dev branch
my files are overwritten, NOT merged.
Thank you, Simon
Check your "config" file inside your ".git" folder of your local repository or global.
In that, if notes.mergeStrategy is configured to "theirs", then your changes will be overwritten. You just need to remove that configuration and everything will be fine.
Ref:
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