-
-
Save ummahusla/8ccfdae6fbbe50171d77 to your computer and use it in GitHub Desktop.
# overwrite master with contents of feature branch (feature > master) | |
git checkout feature # source name | |
git merge -s ours master # target name | |
git checkout master # target name | |
git merge feature # source name |
That still leaves non-conflicting stuff in master. Say i deleted shit in seotweaks but master still has them, the merge will let master keep it because it doesn't conflict, it's just master "adding" things.
If refusing to merge unrelated histories
You may need to use --allow-unrelated-histories
if the histories don't line up
Would anyone care to explain what the 3rd line does? Please.
Would anyone care to explain what the 3rd line does? Please.
see this for "ours" merge strategy
Thanks, I'm a beginner and I was having trouble with this!
Thank you!
This is amazing!
Thank you.
Is it required to do git push after 5th step “git merge feature” ? Also should we expect git status to show any files which are different and which will be overwritten ?
Awesome, worked like a charm. One thing i will add though is to use git push -f
in case you can't push
This works. Thank you!
Awesome, worked like a charm. One thing i will add though is to use
git push -f
in case you can't push
Thank you!! I needed this one. Would've had a breakdown otherwise.
Thank you, this was perfect :)
Approved, that works! Thanks
That still leaves non-conflicting stuff in master. Say i deleted shit in seotweaks but master still has them, the merge will let master keep it because it doesn't conflict, it's just master "adding" things.
git checkout -B master anotherbranch
See https://stackoverflow.com/a/29871400/148680
Is there a reset head or something that's missing from the equation though? When I try to go back and merge other branches back into the target branch, git thinks they are already in there.