Git self-taught --Pull Request

Launched a new PR (pull request) easier, you can click on the page, pay attention to choose a good target branch.

Next, will enter the stage of review, this stage may be more lengthy, review the comments and revise your commit, even reply

In this long stage, to merge the PR branch target may turn has a lot of submission, even if your PR is review by, and things to resolve conflicts is a troublesome, you can choose on a similar web-site through GitHub modify the conflict (if less conflict or can), is another way to resolve the conflict in the local (IDE's help) and then push up.

Next, tell us about the PR in the long stage, how to keep the code with minimal conflict situations, and keep the number of commit only one (a lot of people commit only a requirement of PR)

For example, his branch is feature/testthe target branch isdev

  1. To ensure that local feature/testand devbranch codes are up to date

  2. Switch to feature/testbranch execution

git rebase dev
  1. After manually resolve the conflict, the implementation of
git add .

Used to mark a file conflict has been resolved.

  1. git status Look, if files are green, you can continue to rebase
git rebase --continue

Let rebase to continue. If a conflict still occurs, perform steps 3 and 4 again.

  1. If you need to commit to the number of compressed into one, I choose here to use reset
git reset --soft [commit-id]

Here [commit-id] refers feature/testand devthe branch common parent node.

  1. And then perform a commit
git commit -m "just test"
  1. All goes well, the implementation of push (need strong push)
git push -f origin feature/test

Repeating the above steps, it is possible to spend a long PR review stage until the final success of merge to the target branch.

Reproduced in: https: //www.jianshu.com/p/7020c8fc3321

Guess you like

Origin blog.csdn.net/weixin_34247032/article/details/91098123