GIT uses Cherry-pick to replay other branch submissions

Source: Internet
Author: User
Tags using git

Whether you encounter this problem when using git:you're using Git for versioning, and one day you went on to work yesterday and you submitted n commits, and the result is that when you merge the remote branch, you don't notice the state of the branch you're submitting before you work .As a result, the results of your submission to the hotfix branch are all submitted to the Dev branch, and the remote branch your colleague has already submitted a lot of changes, what if you encounter this situation?
    1. Extract all commits from the remote branch (at this point your local hotfix branch is the same as the remote branch)
    2. On the hotfix branch, submit to the Dev branch using Cherry-pick to merge commits that were originally part of the hotfix branch (requires manual merge conflicts)
    3. Switch the dev branch to remove commits that belong to the hotfix branch or revert directly to the last dev branch history
    4. Switch Hotfix Branch and continue working
since Cherry-pick has not been used, the following are all submissions from creating a warehouse to completing a replay, primarily to understandHow the Cherry-pick works

Git-scm#cherry-pick: It can be understood to resubmit/replay submitted commits (can be in the same branch or different branches)

Reference: Cherry-picking Explained
Git Cherry-pick. How to put commits that have been committed, from one branch to another branch diagram git 3.6 git branch-git cherry-pick to commit to a branch of a part of commit and then commit to the B branch
git cherry-pick handle pull request git cherry-pick best practices a git learning site Replay the last N git commits on a different    Branch how to replay a commit onto a branch that already contains the commit? Test data download: Baidu Cloud Disk



From for notes (Wiz)

GIT uses Cherry-pick to replay other branch submissions

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.