Skip to content

Commit

Permalink
Merge pull request k88hudson#7 from jackmaney/master
Browse files Browse the repository at this point in the history
Added anchor points to sections.
  • Loading branch information
k88hudson committed Jul 30, 2014
2 parents 69204cd + 2a01c08 commit af73270
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ 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

```
(my-branch*)$ git commit --amend
```

<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.
Expand Down Expand Up @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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:

```
Expand All @@ -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


Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -267,4 +274,3 @@ And finally, let's cherry-pick the commit for bug #14:
```
(14)$ git cherry-pick 5ea5173
```

0 comments on commit af73270

Please sign in to comment.