Passa al contenuto principale

GIT - merge tra branch

GIT cherry-pick

  • Copiate l'hash del commit sul branch A
  • Fate il checkout sul branch B e eseguite git cherry-pick <SHA> dove <SHA> è l'hash del commit

Dopo vi farà automaticamente la commit in locale (se ci sono dei conflitti ve li fa risolvere) e dopo dovrete solo pushare sul branch B

Documentazione: https://git-scm.com/docs/git-cherry-pick

Merge massivo di un branch su un altro

https://stackoverflow.com/questions/4624357/how-do-i-overwrite-rather-than-merge-a-branch-on-another-branch-in-git

I wanted to merge two branches so that all the contents in old_branch to be updated with the contents from new_branch

For me this worked like a charm:

$ git checkout new_branch
$ git merge -m 'merge message' -s ours origin/old_branch
$ git checkout old_branch
$ git merge new_branch
$ git push origin old_branch