+5 votes
1 view
in DevOps and Agile by (30k points)
edited by

How can I stash only one of the multiple changed files on my branch?

1 Answer

+6 votes
by (51.2k points)
edited by

Note: These commands will stash all the files after add, so if you need some files just do git add to keep or else all will be gone.

git stash --keep-index

Since git 2.13, there is a command to save a specific path to the stash: 

git stash push <path>

As this command will push all staged and unstaged files in the path but if you use the above command  --keep-index it just leaves the index alone after the stash is done.

For more information about installation of git and common git commands please go through the following link:

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !