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?
- Extract all commits from the remote branch (at this point your local hotfix branch is the same as the remote branch)
- 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)
- Switch the dev branch to remove commits that belong to the hotfix branch or revert directly to the last dev branch history
- 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