Git cherry-pick Introduction

Source: Internet
Author: User

Reprint: http://blog.csdn.net/hudashi/article/details/7669462

git cherry-pick is used to apply commit modifications from another local branch to the current branch. Practical Issues a commit (38361a68138140827b31b72f8bbfd88b3705d77a) was made on the local master branch , and how to put it on the local O On the LD_CC branch? One way: Use cherry-pick. According to the GIT documentation: Apply The changes introduced by some existing commitsis to apply the existing commit (which is understood to be resubmitted) Simple usage :git cherry-pick <commit id>For example:$ git checkout old_cc$ git cherry-pick 38361a68 1. If it goes well, it will be submitted normally. Results:finished one cherry-pick.# on Branch old_cc# Your Branch is ahead of ' ORIGIN/OLD_CC ' by 3 commits.2. If there is a conflict in the process of Cherry-pickAutomatic Cherry-pick failed. After resolving the conflicts,mark the corrected paths with ' git add <paths> ' or ' git rm <paths> 'and commit the result with:
git commit-c 15a2b6c61927e5aed6718de89ad9dafba939a90b
as with ordinary conflicts, manual resolution:execute git status to see which files conflict$ git statusboth modified:app/models/user.rbThen manually resolve the conflicting files, then change to add to the index via git add, and finally execute the GIT commit commit modification. $ vim app/models/user.rb$ git add app/models/user.rbgit commit-c < original commit number >

Git cherry-pick Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.