From 40a542d31a85f2edf69e87a70a841161775c0907 Mon Sep 17 00:00:00 2001 From: Richard Littauer Date: Mon, 30 Sep 2019 08:50:18 -0400 Subject: [PATCH] English language edits --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d8e8c69..d9ddc59 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ All commands should work for at least git version 2.13.0. See the [git website]( - [Stash specific files](#stash-specific-files) - [Stash with message](#stash-with-message) - [Apply a specific stash from list](#apply-a-specific-stash-from-list) - - [Stash with keeping unstaged edit](#stash-with-keeping-unstaged-edit) + - [Stash while keeping unstaged edits](#stash-while-keeping-unstaged-edits) - [Finding](#finding) - [I want to find a string in any commit](#i-want-to-find-a-string-in-any-commit) - [I want to find by author/committer](#i-want-to-find-by-authorcommitter) @@ -606,19 +606,18 @@ Then, you will need to use the `e` option to manually choose which lines to add. ### I want to stage my unstaged edits, and unstage my staged edits -In many cases, You should unstage all files and then pick file you want and commit it. -But assume that's what you want,You can create a temp commit to store your stage files, stage your unstaged files and stash them, Then, reset the temp commit and stash pop. +In many cases, you should unstage all of your staged files and then pick the file you want and commit it. However, if you want to switch the staged and unstaged edits, you can create a temporary commit to store your staged files, stage your unstaged files and then stash them. Then, reset the temporary commit and pop your stash. ```sh $ git commit -m "WIP" -$ git add . # also have untracked files +$ git add . # This will also add untracked files. $ git stash $ git reset HEAD^ $ git stash pop --index 0 ``` -NOTE 1: The reason to use `pop` here is want to keep idempotent as more as possible. -NOTE 2: Your staged files will be marked as unstaged if you miss `--index` flag.[this link](https://stackoverflow.com/questions/31595873/git-stash-with-staged-files-does-stash-convert-staged-files-to-unstaged?answertab=active#tab-top) will explain it to you. +NOTE 1: The reason to use `pop` here is want to keep idempotent as much as possible. +NOTE 2: Your staged files will be marked as unstaged if you don't use the `--index` flag. ([This link](https://stackoverflow.com/questions/31595873/git-stash-with-staged-files-does-stash-convert-staged-files-to-unstaged?answertab=active#tab-top) explains why.) ## Unstaged Edits @@ -1454,7 +1453,9 @@ $ git stash push working-directory-path/filename1.ext working-directory-path/fil ```sh $ git stash save ``` + or + ```sh $ git stash push -m ``` @@ -1476,14 +1477,14 @@ $ git stash apply "stash@{n}" Here, 'n' indicates the position of the stash in the stack. The topmost stash will be position 0. -Furthermore, time based also possible(If you can remember). +Furthermore, using a time-based stash reference is also possible. ```sh $ git stash apply "stash@{2.hours.ago}" ``` -### Stash with keeping unstaged edit +### Stash while keeping unstaged edits You can manually create a `stash commit`, and then use `git stash store`.