Introduction
This guide demonstrates how to add files to a stash using Lazygit. Stashing is useful for temporarily setting aside changes in your working directory.
Lazygit
-
Press
2
to switch to the 2. Files panel. -
Navigate to the desired files using
↓
/↑
keys or asingle click
. -
Once you’ve highlighted a file:
- Press the
s
key to mark individual files for stashing.
- Press the
-
Observe the changes in the Files window as you select files for stashing.
-
For regular stashing, press
s
. However, for more options:- Press
Shift+S
to access the Stash Options menu.
![Stash Options Menu](Pasted image 20230722132623.png)
- Press
-
In the Stash Options menu:
- Choose “stash staged changes” and press
Enter
. - Enter a message for your stash when prompted.
![Enter Stash Message](Pasted image 20230722132743.png)
- Choose “stash staged changes” and press
-
Confirm the stash is created:
- Look at the bottom-left window to see your new stash entry.
![Stash Entry Confirmation](Pasted image 20230722132815.png)
Basic Terminal
To perform a similar action in the terminal:
-
Stage the files you want to stash:
-
Stash the staged changes with a message:
-
To confirm the stash was created:
This process in the terminal provides a straightforward way to handle stashing, complementing the Lazygit approach.