-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contributing: commiter git FAQ #68
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,10 +61,10 @@ Okay, so you have decided on the proper branch. Create a feature branch | |
and start hacking: | ||
|
||
```sh | ||
$ git checkout -b my-feature-branch -t origin/v0.10 | ||
$ git checkout -b my-feature-branch -t origin/v0.12 | ||
``` | ||
|
||
(Where v0.10 is the latest stable branch as of this writing.) | ||
(Where v0.12 is the latest stable branch as of this writing.) | ||
|
||
|
||
### COMMIT | ||
|
@@ -113,7 +113,7 @@ Use `git rebase` (not `git merge`) to sync your work from time to time. | |
|
||
```sh | ||
$ git fetch upstream | ||
$ git rebase upstream/v0.10 # or upstream/master | ||
$ git rebase upstream/v0.12 # or upstream/master | ||
``` | ||
|
||
|
||
|
@@ -214,6 +214,110 @@ expertise to take full responsibility for the change, according to the | |
contained. Meaning, every commit should pass all tests. This makes | ||
it much easier when bisecting to find a breaking change. | ||
|
||
### Direct instruction | ||
|
||
(Optional) Ensure that you are not in a borked `am`/`rebase` state | ||
|
||
```sh | ||
git am --abort | ||
git rebase --abort | ||
``` | ||
|
||
Checkout proper target branch | ||
|
||
```sh | ||
git checkout v0.12 | ||
``` | ||
|
||
Update the tree | ||
|
||
```sh | ||
git fetch origin | ||
git merge --ff-only origin/v0.12 | ||
``` | ||
|
||
Apply external patches | ||
|
||
```sh | ||
curl https://github.com/iojs/io.js/pull/xxx.patch | git am | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
``` | ||
|
||
Check and re-review the changes | ||
|
||
```sh | ||
git diff origin/v0.12 | ||
``` | ||
|
||
Check number of commits and commit messages | ||
|
||
```sh | ||
git log origin/v0.12...v0.12 | ||
``` | ||
|
||
If there are multiple commits that relate to the same feature or | ||
one with a feature and separate with a test for that feature - | ||
you'll need to squash them (or strictly speaking `fixup`). | ||
|
||
```sh | ||
git rebase -i origin/v0.12 | ||
``` | ||
|
||
This will open a screen like this (in the default shell editor): | ||
|
||
```sh | ||
pick 6928fc1 crypto: add feature A | ||
pick 8120c4c add test for feature A | ||
pick 51759dc feature B | ||
pick 7d6f433 test for feature B | ||
|
||
# Rebase f9456a2..7d6f433 onto f9456a2 | ||
# | ||
# Commands: | ||
# p, pick = use commit | ||
# r, reword = use commit, but edit the commit message | ||
# 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 | ||
# x, exec = run command (the rest of the line) using shell | ||
# | ||
# These lines can be re-ordered; they are executed from top to bottom. | ||
# | ||
# If you remove a line here THAT COMMIT WILL BE LOST. | ||
# | ||
# However, if you remove everything, the rebase will be aborted. | ||
# | ||
# Note that empty commits are commented out | ||
``` | ||
|
||
Replace a couple of `pick`s with `fixup` to squash them into a previous commit: | ||
|
||
```sh | ||
pick 6928fc1 crypto: add feature A | ||
fixup 8120c4c add test for feature A | ||
pick 51759dc feature B | ||
fixup 7d6f433 test for feature B | ||
``` | ||
|
||
Replace `pick` with `reword` to change the commit message: | ||
|
||
```sh | ||
reword 6928fc1 crypto: add feature A | ||
fixup 8120c4c add test for feature A | ||
reword 51759dc feature B | ||
fixup 7d6f433 test for feature B | ||
``` | ||
|
||
Save the file and close the editor, you'll be asked to enter new commit message | ||
for that commit, and everything else should go smoothly. Note that this is a | ||
good moment to fix incorrect commit logs, ensure that they are properly | ||
formatted, and add `Reviewed-By` line. | ||
|
||
Time to push it: | ||
|
||
```sh | ||
git push origin v0.12 | ||
``` | ||
|
||
# Governance | ||
|
||
This repository is jointly governed by a technical committee, commonly | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to prefer fetch + ff-only merge over
git pull --rebase
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
fetch
+merge
is much more explicit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on more explicit