Skip to content

Commit

Permalink
Merge pull request k88hudson#101 from k88hudson/feat/staging-the-unst…
Browse files Browse the repository at this point in the history
…aged

Added section on staging and unstaging
  • Loading branch information
RichardLitt authored Jan 6, 2017
2 parents bad1b36 + 57b67d4 commit c89b20a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ For clarity's sake all examples in this document use a customized bash prompt in
- [I need to add staged changes to the previous commit](#i-need-to-add-staged-changes-to-the-previous-commit)
- [I want to stage part of a new file, but not the whole file](#i-want-to-stage-part-of-a-new-file-but-not-the-whole-file)
- [I want to add changes in one file to two different commits](#i-want-to-add-changes-in-one-file-to-two-different-commits)
- [I want to stage my unstaged edits, and unstage my staged edits](#i-want-to-stage-my-unstaged-edits-and-unstage-my-staged-edits)
- [Unstaged Edits](#unstaged-edits)
- [I want to move my unstaged edits to a new branch](#i-want-to-move-my-unstaged-edits-to-a-new-branch)
- [I want to move my unstaged edits to a different, existing branch](#i-want-to-move-my-unstaged-edits-to-a-different-existing-branch)
Expand Down Expand Up @@ -240,6 +241,18 @@ Then, you will need to use the `e` option to manually choose which lines to add.
`git add` will add the entire file to a commit. `git add -p` will allow to interactively select which changes you want to add.


<a href="unstaging-edits-and-staging-the-unstaged"></a>
### I want to stage my unstaged edits, and unstage my staged edits

This is tricky. The best I figure is that you should stash your unstaged edits. Then, reset. After that, pop your stashed edits back, and add them.

```sh
$ git stash -k
$ git reset --hard
$ git stash pop
$ git add -A
```

## Unstaged Edits

<a href="move-unstaged-edits-to-new-branch"></a>
Expand Down

0 comments on commit c89b20a

Please sign in to comment.