DEV Community

Discussion on: Advanced Git Concepts You Should Know

Collapse
 
igormelo profile image
Igor Melo

Nice article. Just some corrections about stashing:

To use stash, you need to add the files to the staging area

You don't have to add changes to staging area to be able to stash it.

Example:

$ git status -s
 M unstaged.txt
A  staged.txt
?? untracked.txt
Enter fullscreen mode Exit fullscreen mode

Here I have an unstaged file (which is being tracked), a staged file and an untracked file.
If I want to stash all tracked files, I can just do:

$ git stash
Enter fullscreen mode Exit fullscreen mode

If I want to include untracked, I can add -u.

Collapse
 
ruppysuppy profile image
Tapajyoti Bose

Thanks for sharing!