Discard local uncommitted changes (#156)

This commit is contained in:
Josh 2017-11-27 13:30:38 -05:00 committed by Richard Littauer
parent 02043187a7
commit 7440fa32b5
1 changed files with 24 additions and 0 deletions

View File

@ -38,6 +38,8 @@ For clarity's sake all examples in this document use a customized bash prompt in
- [I want to move my unstaged edits to a different, existing branch](#i-want-to-move-my-unstaged-edits-to-a-different-existing-branch)
- [I want to discard my local, uncommitted changes](#i-want-to-discard-my-local-uncommitted-changes)
- [I want to discard specific unstaged changes](#i-want-to-discard-specific-unstaged-changes)
- [I want to discard specific unstaged files](#i-want-to-discard-specific-unstaged-files)
- [I want to discard all of my local changes](#i-want-to-discard-all-of-my-local-changes)
- [Branches](#branches)
- [Create a branch from a commit](#create-branch-from-commit)
- [I pulled from/into the wrong branch](#i-pulled-frominto-the-wrong-branch)
@ -338,6 +340,28 @@ $ git stash -p
$ git stash drop
```
### I want to discard specific unstaged files
When you want to get rid of one specific file in your working copy.
```sh
$ git checkout myFile
```
Alternatively, to discard multiple files in your working copy, list them all.
```sh
$ git checkout myFirstFile mySecondFile
```
### I want to discard all of my local changes
When you want to get rid of all of your local uncommitted changes
```sh
$ git checkout .
```
## Branches
<a name="create-branch-from-commit"></a>
### Create a branch from a commit