Habitual problems like to checkout a new branch before development, and then merge to the development branch.
However, goose merge needs to checkout to development first and then
git merge branchThen checkout and come back.
Is there any elegant way to implement so
git merge-into xxxThis kind of operation?
First answer the question. Use fork+pull request to meet your needs.
Next, I would like to say a few important points.
- The reason why the target branch must be checked out before merging is to ensure that the target branch is up-to-date, and all branches may finish branching after merging. Therefore, it is not enough to checkout the latest branch, and fetch+merge is needed to keep the target branch up to date before the source branch can be merged in.
- Whether it is a branch-based approach or fork workflow, rebase should be used instead of merge. rebase is convenient to keep the whole tree clean and tidy, convenient for other team members to develop, and will not produce more useless records.
- Both fork and branch methods can be used to collate and submit records of the current branch of rebase before merging to ensure that the submission is readable.