How do you stash only some files, or stash untracked and ignored files?
IntermediateConceptUndoing changes: reset, revert, restore and reflog
Answer
Use pathspecs, -u for untracked, -a for all including ignored, and -p to pick hunks. --keep-index stashes only unstaged changes.
git stash push -m "wip" -- src/api.py
git stash push -u
git stash push -p
More on Undoing changes: reset, revert, restore and reflog
What are the three modes of `git reset`?BeginnerWhat is the difference between `git reset` and `git revert`?BeginnerHow do you discard changes in one file?BeginnerHow do you recover a commit after `git reset --hard`?IntermediateCan you recover uncommitted changes lost by `git reset --hard` or `git checkout .`?IntermediateWhat does `git commit --amend` do to the reflog and to the old commit?Intermediate