From e0a934821e8fa39814d693a5292561f3876c2e8c Mon Sep 17 00:00:00 2001 From: scbj Date: Thu, 23 Jan 2025 17:14:19 +0100 Subject: [PATCH] added section for `git stash` --- git.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/git.md b/git.md index 7a4ccd1..7449d3a 100644 --- a/git.md +++ b/git.md @@ -7,6 +7,7 @@ - [branches](#branches) - [create a branch](#create-a-branch) - [submodules](#submodules) +- [stash](#stash) - [removing files from index](#removing-files-from-index) - [philosophies](#philosophies) - [merge](#merge) @@ -53,6 +54,13 @@ git submodule update --init --recursive ``` +## stash + +If the current tree is dirty, one can use `git stash` to temporarily save the changes and reset the tree to the last commit. +Afterwards the changes can be reapplied with `git stash pop`. +This can be useful if for example one would like to create a new branch for the current changes. + + ## removing files from index To remove files from index without deleting them on disk, use: