Phil Hudson
Phil Hudson

Reputation: 3901

Git Cherry Pick - clarification

As it wasn't completely clear to me from existing documentation and questions could someone please confirm the following.

Cherry Pick will only commit the changes in the files from the commit select. It will not backtrack and essentially merge changes from other files.

E.g. I want to add a feature from my develop branch to my master branch. I want to cherry pick a commit and I only want the files in the commit to be merged onto master.

Is this the correct way of doing this.

Many thanks.

Upvotes: 0

Views: 71

Answers (1)

love
love

Reputation: 1040

Cherry-pick a commit will merge only those files which are present in that commit. It may be the case that some times "cherry-pick" get failed due to merge conflicts or local changes.

But in your case, just simply use;

git cherry-pick commit-id

yes, It will only merge files in the commit to be merged onto master (if you don't have any local changes). Please proceed :)

Upvotes: 2

Related Questions