Reputation: 2608
what's complicated in that : I want to copy the last commit from "dev" branch to "master" branch.
I am doing this
git checkout master
git cherry-pick a6b9463bec0a5240f6e945fbf4951c932751f28d
and I get an error :
git cherry-pick a6b9463bec0a5240f6e945fbf4951c932751f28d
error: could not apply a6b9463... releasing v1.00
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
git status
gives
$ git status
# On branch master
# You are currently cherry-picking.
# (fix conflicts and run "git commit")
#
# Unmerged paths:
# (use "git add <file>..." to mark resolution)
#
# both modified: index.html
# both modified: js/boardDims.js
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# config.xml.orig
no changes added to commit (use "git add" and/or "git commit -a")
I don't see why it's that complicated to copy a comit to another branch. Can you give me command to copy this commit to my master branch ?
Thanks
Upvotes: 0
Views: 448
Reputation: 44448
When you cherry pick, you're copying a "change", not the files themselves. When copying a change, the process is very similar to creating a patch of the last commit from the dev branch and applying that patch on the master branch. If the patch fails, which it did, Git will tell you to resolve the conflict, which it did.
While most of the time cherry picking is used to grab a single commit, it can be used to grab a series of commits.
To resolve the conflicts, you can use git mergetool
Here's a visual explanation of cherry picking. (Scroll down to the slide show at the bottom)
Upvotes: 1
Reputation: 43314
It's only "complicated" because there are merge conflicts when you cherrypick the commit. This is normal behaviour if commits from different branches changed the same line in common file.
You can learn something about solving merge conflicts here
Upvotes: 0
Reputation: 21887
You're running the correct command and it's telling you that you have conflicted changes in index.html
and js/boardDims.js
. Resolve the conflicts with a diff tool, run git add
on each of them and finally git commit
to commit the merge.
Upvotes: 1