'How to copy commits from one branch to master branch?

I am using Android studio and commandline both. I have a feature branch that has become a superset of my master branch.

I want to merge all diff commits from this feature branch to master branch. How this can be done.



Solution 1:[1]

You can do this :

git checkout master
git merge --no-ff feature-branch

Solution 2:[2]

Use cherry pick: https://www.jetbrains.com/help/idea/apply-changes-from-one-branch-to-another.html#cherry-pick

This way you can checkout master, then apply (cherry pick) specific commit from other branch (your feature branch).

Enjoy ?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alaindeseine
Solution 2 Shlomi Katriel