Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions suggestions/Git Stash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Temporary Storage: `git stash` is used to temporarily save your current changes, including both staged and unstaged ones.

Task Switching: It's helpful when you need to switch to another task or branch without committing unfinished work.

Stash Creation: By running `git stash`, you create a stash that resets your working directory to the state of the last commit.

Stash Application and Pop: `git stash apply` or `git stash pop` bring back the stashed changes. The former retains the stash, while the latter deletes it.

Multiple Stashes: You can create multiple stashes, each with a unique index (starting from 0).

Stash Inspection: `git stash list` displays a list of stashes with their indices, descriptions, and base commits.

Custom Messages: You can add descriptions to stashes using `git stash save "message"`.

Branching: Stash changes, switch to another branch, work, then come back and reapply the stashed changes.

Untracked Files: By default, untracked files aren't stashed. Use `git stash --include-untracked` to stash them.