Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 888 Bytes

stash-specific-files-and-filenames.md

File metadata and controls

16 lines (10 loc) · 888 Bytes

Stash Specific Files and Filenames

Why would you ever want to stash a specific file, as opposed to any and all altered files, you ask? In an ideal world, you probably wouldn't need to. In this specific case, I was attempting to stash files I had modified without stashing other files which had been bulk-edited by a script. In other words, I wished to throw away most of my changes and keep one or two specific changes after a git merge.

See this question, of which the accepted answer is pretty darn useful:

Since git 2.13, there is a command to save a specific path to the stash: git stash push . For example: git stash push -m welcome_cart app/views/cart/welcome.thtml.

Boom:

git stash push <path>