Reputation: 11
I have a feature branch I am working on. There is a test server that I ssh into and pull my feature branch from master. So throughout the day, I make changes on my feature branch and push them. However, whenever I try out the changes on my test server by ssh'ing into , checking out master
and then pulling my feature branch, I get merge conflicts each time. The first few times, I manually resolved them but I get them every time now. Is there any way to avoid this and to just have it overwrite them?
Upvotes: 1
Views: 847
Reputation: 11484
It sounds like your feature branch is behind your master branch. Try and push your master branch to your remote repository, pull your master branch to your local machine and create your new feature branch from the up-to-date master branch. When you're done with your feature, you should be able to push your new feature branch and pull it into master without getting merge conflicts.
Keep in mind that you would have to repeat the process above every time you update your master branch.
A short-term solution to your last question,
"Is there any way to avoid this and to just have it overwrite them?"
is to set the "theirs" option on the recursive merge strategy (the default merge strategy) when pulling from your feature branch, for example: git pull -Xtheirs origin feature-branch
.
However, since you mentioned that it is a test server you want test your changes on, you might want to consider rather just checking your feature branch out as @eftshift0 mentioned and to reserve your master branch for features you've already tested. To checkout your feature branch you could use git fetch && git checkout origin/feature-branch
.
Upvotes: 1