Pull single commits with GIT cherry picking

Description:

We need to pull into a separate branch a few number of commits from another branch.

Solution:

GIT version control tool offers the solution: cherry picking.

Commit your changes to the branch, and tell GIT you want to use selected branch commits, by using the commit hash you can find in the log.

First, get the commit hash from the log:

$ git log -1

Then, cherry pick only the desired commit, and pull it into your branch:

$ git cherry-pick <commit hash>

That’s it, now the cherry picked commits will be merged into your branch, without having the whole other branch.

Advertisements

About admin

Just another php developer trying to give something back to the community.
This entry was posted in Tools and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s