From c8abe4cc13d1ed340525d1dab18a65b29f0d343f Mon Sep 17 00:00:00 2001 From: Diogo Lemos Date: Fri, 24 Feb 2017 11:29:18 +0000 Subject: [PATCH] Add stash of unstaged changes to tracked files --- README.md | 17 +++++++++++++++++ tips.json | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/README.md b/README.md index 3afcc9f..b7e549b 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ P.S: All these commands are tested on `git version 2.7.4 (Apple Git-66)`. * [Find out branches containing commit-hash](#find-out-branches-containing-commit-hash) * [Git Aliases](#git-aliases) * [Saving current state of tracked files without commiting](#saving-current-state-of-tracked-files-without-commiting) +* [Saving current state of unstaged changes to tracked files](#saving-current-state-of-unstaged-changes-to-tracked-files) * [Saving current state including untracked files](#saving-current-state-including-untracked-files) * [Saving current state with message](#saving-current-state-with-message) * [Show list of all saved stashes](#show-list-of-all-saved-stashes) @@ -406,6 +407,22 @@ __Alternatives:__ git stash save ``` +## Saving current state of unstaged changes to tracked files +```sh +git stash -k +``` + + +__Alternatives:__ +```sh +git stash --keep-index +``` + + +```sh +git stash save --keep-index +``` + ## Saving current state including untracked files ```sh git stash save -u diff --git a/tips.json b/tips.json index 0f7c9e4..ab99a12 100644 --- a/tips.json +++ b/tips.json @@ -120,6 +120,10 @@ "title": "Saving current state of tracked files without commiting", "tip": "git stash", "alternatives": ["git stash save"] +}, { + "title": "Saving current state of unstaged changes to tracked files", + "tip": "git stash -k", + "alternatives": ["git stash --keep-index", "git stash save --keep-index"] }, { "title": "Saving current state including untracked files", "tip": "git stash save -u",