Merge pull request #7 from jackmaney/master

Added anchor points to sections.
This commit is contained in:
Kate Hudson 2014-07-30 13:09:55 -04:00
commit af732704df
1 changed files with 9 additions and 3 deletions

View File

@ -16,7 +16,7 @@ A [guide for astronauts](http://www.jsc.nasa.gov/news/columbia/fr_generic.pdf) (
For clarity's sake all examples in this document use customized bash prompt in order to indicate the current branch and whether or not there are staged changes. The branch is enclosed in parentheses, and a `*` next to the branch name indicates staged changes.
<a name="amend"></a>
## I need to add staged changes to the previous commit
```
@ -24,10 +24,12 @@ For clarity's sake all examples in this document use customized bash prompt in o
```
<a name="force-push"></a>
### I tried to push my amended commit to a remote, but I got an error message
Note that, as with rebasing (see below), amending **replaces the old commit with a new one**, so you must force push (`-f`) your changes if you have already pushed the pre-amended commit to your remote. Be careful when you do this &ndash; *always* make sure you specify a branch!
<a name="interactive-rebase"></a>
## I need to combine commits
You need to do something called an interactive rebase.
@ -112,6 +114,7 @@ If everything is successful, you should see something like this:
### Possible issues with interactive rebases
<a name="noop"></a>
#### The rebase editing screen says 'noop'
If you're seeing this:
@ -124,6 +127,7 @@ That means you are trying to rebase against a branch that is at an identical com
* making sure your master branch is where it should be
* rebase against `HEAD~2` or earlier instead
<a name="merge-conflict"></a>
#### There were conflicts
If you are unable to successfully complete the rebase, you may have to resolve conflicts.
@ -165,6 +169,7 @@ If at any time you want to stop the entire rebase and go back to the original st
(my-branch)$ git rebase --abort
```
<a name="force-push"></a>
#### When I try to push, I get an error message:
```
@ -183,6 +188,7 @@ Since rebasing **replaces the old commit(s) with a new one**, you must force pus
(mybranch) $ git push origin mybranch -f
```
<a name="commit-wrong-branch"></a>
## I committed to master instead of a new branch
@ -203,6 +209,7 @@ For example, if the hash of the commit that your master branch is supposed to be
HEAD is now at a13b85e
```
<a name="cherry-pick"></a>
## I made several commits on a single branch that should be on different branches
Say you are on your master branch. Running `git log`, you see you have made two commits:
@ -251,7 +258,7 @@ Now, let's *cherry-pick* the commit for bug #21 on top of our branch. That means
(21)$ git cherry-pick e3851e8
```
At this point, there is a possibility there might be conflicts. See the **There were conflicts** section in the interactive rebasing section (above) for how to resolve conflicts.
At this point, there is a possibility there might be conflicts. See the [**There were conflicts**](#merge-conflict) section in the [interactive rebasing section above](#interactive-rebase) for how to resolve conflicts.
Now let's create a new branch for bug #14, also based on master
@ -267,4 +274,3 @@ And finally, let's cherry-pick the commit for bug #14:
```
(14)$ git cherry-pick 5ea5173
```