Back

Explore Courses Blog Tutorials Interview Questions
+4 votes
1 view
in DevOps and Agile by (29.3k points)
edited by

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

1 Answer

+5 votes
by (50.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

+6 votes
2 answers
0 votes
1 answer
asked Aug 2, 2019 in DevOps and Agile by Han Zhyang (19.7k points)
+1 vote
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.2k users

Browse Categories

...