Can I merge a branch without deleting it?
If I have branch "personal-work-in-progress", and a branch "feature/ABC-123" that is five commits ahead of it, is it possible to merge the five commits from feature/ABC-123 into personal-work-in-progress without deleting the feature/ABC-123 branch?
I know doing five git cherry-pick
commands would do it, but that seems a bit tedious and error-prone.
The more the branches and master diverge away from each other the farther away their “common ancestor” commit becomes. When you're done with a branch and it has been merged into master, delete it. A new branch can be made off of the most recent commit on the master branch.
To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch.
You can do it like this: git checkout missing-commits git checkout -b correct-merge git merge D # do it right, this time around!
Try this
git merge branch_name
https://www.atlassian.com/git/tutorials/using-branches/git-merge
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