Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Bitbucket, how do I get commits from one branch into another?

At my new job, where we use git with Bitbucket, we have a master branch, a new-features branch and a fix-these branch.

I've been making all my changes to the fix-these branch. After committing them, I push them to origin/fix-these using SourceTree. So far, so good.

In Bitbucket, how do I make the fix-these branch so that it includes the few commits that have been made recently to new-features? (And then I just "pull origin/fix-these" to make my local copy current, right?)

like image 679
Roger_S Avatar asked Jul 15 '15 15:07

Roger_S


3 Answers

You cant, you'll have to use git commands. Would have been nice with a web interface for it like pull requests.

like image 184
Karsten Sperling Opdal Avatar answered Oct 23 '22 11:10

Karsten Sperling Opdal


Use git cherry pick. It lets you pick commit and add them over other branches.

git cherry-pick <commit> 

Example:

git cherry-pick 123456

This will add the commit on the current branch.

like image 27
Ankit Avatar answered Oct 23 '22 12:10

Ankit


As Tim suggested, you'll want to merge new-features into fix-these.

You can do this on Bitbucket by navigating to the Compare page (see sidebar), selecting "fix-these" as destination, "new-features" as source and then hitting the Merge button in the top-right corner.

like image 30
Erik van Zijst Avatar answered Oct 23 '22 11:10

Erik van Zijst