From 86c85086109ee0502237e942ca7bf979bfcc75d5 Mon Sep 17 00:00:00 2001 From: RPing Date: Mon, 1 Jun 2020 01:07:15 +0800 Subject: Update github-workflow.md --- contributors/guide/github-workflow.md | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'contributors/guide') diff --git a/contributors/guide/github-workflow.md b/contributors/guide/github-workflow.md index aae63e63..0f989907 100644 --- a/contributors/guide/github-workflow.md +++ b/contributors/guide/github-workflow.md @@ -93,7 +93,7 @@ Please don't use `git pull` instead of the above `fetch` / `rebase`. `git pull` does a merge, which leaves merge commits. These make the commit history messy and violate the principle that commits ought to be individually understandable and useful (see below). You can also consider changing your `.git/config` file via -`git config branch.autoSetupRebase always` to change the behavior of `git pull`. +`git config branch.autoSetupRebase always` to change the behavior of `git pull`, or another non-merge option such as `git pull --rebase`. ### 5 Commit @@ -156,26 +156,26 @@ To squash your commits, perform an [interactive rebase](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History): 1. Check your git branch: - + ``` git status ``` - + Output is similar to: - + ``` On branch your-contribution Your branch is up to date with 'origin/your-contribution'. ``` - -2. Start an interactive rebase using a specific commit hash, or count backwards from your last commit using `HEAD~`, where `` represents the number of commits to include in the rebase. + +2. Start an interactive rebase using a specific commit hash, or count backwards from your last commit using `HEAD~`, where `` represents the number of commits to include in the rebase. ``` git rebase -i HEAD~3 ``` - - Output is similar to: - + + Output is similar to: + ``` pick 2ebe926 Original commit pick 31f33e9 Address feedback @@ -189,31 +189,31 @@ rebase](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History): # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message - + ... - + ``` -3. Use a command line text editor to change the word `pick` to `fixup` for the commits you want to squash, then save your changes and continue the rebase: +3. Use a command line text editor to change the word `pick` to `fixup` for the commits you want to squash, then save your changes and continue the rebase: ``` pick 2ebe926 Original commit squash 31f33e9 Address feedback pick b0315fe Second unit of work - + ... - + ``` - - Output (after saving changes) is similar to: - + + Output (after saving changes) is similar to: + ``` [detached HEAD 61fdded] Second unit of work Date: Thu Mar 5 19:01:32 2020 +0100 2 files changed, 15 insertions(+), 1 deletion(-) - + ... - + Successfully rebased and updated refs/heads/master. ``` 4. Force push your changes to your remote branch: @@ -228,7 +228,7 @@ masse. This makes reviews easier. ### Merging a commit -Once you've received review and approval, your commits are squashed, your PR is ready for merging. +Once you've received review and approval, your commits are squashed, your PR is ready for merging. Merging happens automatically after both a Reviewer and Approver have approved the PR. If you haven't squashed your commits, they may ask you to do so before approving a PR. -- cgit v1.2.3