Repository: incubator-rocketmq-site Updated Branches: refs/heads/master 9f63cc1cf -> 773ce3d20
Add blog, the correct posture of submitting pull request Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/commit/773ce3d2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/tree/773ce3d2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/diff/773ce3d2 Branch: refs/heads/master Commit: 773ce3d20a5256b253e4a45347372e3c735a1079 Parents: 9f63cc1 Author: dongeforever <[email protected]> Authored: Fri Mar 24 15:56:29 2017 +0800 Committer: dongeforever <[email protected]> Committed: Fri Mar 24 15:56:29 2017 +0800 ---------------------------------------------------------------------- ...orrect-posture-of-submitting-pull-request.md | 67 ++++++++++++++++++++ 1 file changed, 67 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-site/blob/773ce3d2/_posts/2017-03-24-the-correct-posture-of-submitting-pull-request.md ---------------------------------------------------------------------- diff --git a/_posts/2017-03-24-the-correct-posture-of-submitting-pull-request.md b/_posts/2017-03-24-the-correct-posture-of-submitting-pull-request.md new file mode 100644 index 0000000..8806d66 --- /dev/null +++ b/_posts/2017-03-24-the-correct-posture-of-submitting-pull-request.md @@ -0,0 +1,67 @@ +## The correct posture of submitting a PR + + +### Fork the original repo +* fork the original repo, and clone it. + +> git clone https://github.com/dongeforever/incubator-rocketmq.git + +* add original remote repo + +> git remote add apache https://github.com/apache/incubator-rocketmq.git + +* show the remote repos + +> git remote -v +> apache https://github.com/apache/incubator-rocketmq.git (fetch) +> apache https://github.com/apache/incubator-rocketmq.git (push) +> origin https://github.com/dongeforever/incubator-rocketmq.git (fetch) +> origin https://github.com/dongeforever/incubator-rocketmq.git (push) + +### Use a new branch to write your own code and commit +you'd better use a new branch for each PR, for it is convenient to manage your code and commits +> git checkout -b new_pr +> git push -u origin new_pr + + +### [Important] rebase instead of merge +> git fetch apache +> git rebase apache/develop +> git push + +Note: if using merge, it will dirty the commits + +the difference between rebase and merge can refer to: +https://www.atlassian.com/git/tutorials/merging-vs-rebasing + + + +### [Suggested]squash the commits +you can code and commit as usual. But when you think it is time to submit a PR, it is better to squash your commits into single one, for that others can easily identify your PR from the history commits. +you can squash as follows: +> gt reset \<the latest commit that dose not belong to you PR\> +> git add --all +> git commit -m "attach the issue or jira" +> git push -f + + +For example: +> git log + + + +> git resset b4108d2d9d3b1522e45ac5e7ea37106f2135bfa0 +> git commit -m 'Add batch feature' +> git log + + +> git push -f + + + +### Attach jira or issue +For now, we have finished the preparations of a PR. It is time to create it. For apache projects, we could attach the jira issue using specific title like "[XXX] add something", such as "[ROCKETMQ-80] Add batch feature", the "XXX" represents the the name of the jira issue. +you could refer to: +https://github.com/apache/incubator-rocketmq/pull/53 + +
