2

Git overwrite branch with another branch

 1 year ago
source link: https://gist.github.com/ummahusla/8ccfdae6fbbe50171d77
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Git overwrite branch with another branch · GitHub

Instantly share code, notes, and snippets.

Git overwrite branch with another branch

This is exactly what I needed. Loads of complicated guides online and this simple fix is perfect, cheers.

Thanks a lot !

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK