𝐆𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐂𝐨𝐦𝐦𝐚𝐧𝐝𝐬

𝐆𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐂𝐨𝐦𝐦𝐚𝐧𝐝𝐬

"Master Git Stash commands!

Published Jul 15, 2024
• 𝐒𝐭𝐚𝐬𝐡 𝐂𝐡𝐚𝐧𝐠𝐞𝐬
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡` Stashes both staged and unstaged changes.
• 𝐒𝐭𝐚𝐬𝐡 𝐰𝐢𝐭𝐡 𝐚 𝐌𝐞𝐬𝐬𝐚𝐠𝐞
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐬𝐚𝐯𝐞 “𝐘𝐨𝐮𝐫 𝐬𝐭𝐚𝐬𝐡 𝐦𝐞𝐬𝐬𝐚𝐠𝐞”` Stashes changes with a descriptive message.
• 𝐒𝐭𝐚𝐬𝐡 𝐔𝐧𝐭𝐫𝐚𝐜𝐤𝐞𝐝 𝐅𝐢𝐥𝐞𝐬
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 -𝐮 𝐨𝐫 𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 — 𝐢𝐧𝐜𝐥𝐮𝐝𝐞-𝐮𝐧𝐭𝐫𝐚𝐜𝐤𝐞𝐝` Stashes untracked files along with changes.
• 𝐋𝐢𝐬𝐭 𝐒𝐭𝐚𝐬𝐡𝐞𝐬
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐥𝐢𝐬𝐭` Lists all stashes you’ve created.
• 𝐀𝐩𝐩𝐥𝐲 𝐋𝐚𝐭𝐞𝐬𝐭 𝐒𝐭𝐚𝐬𝐡
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐚𝐩𝐩𝐥𝐲` Applies the latest stash to the working directory. The stash is not removed.
• 𝐀𝐩𝐩𝐥𝐲 𝐚 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜 𝐒𝐭𝐚𝐬𝐡
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐚𝐩𝐩𝐥𝐲 𝐬𝐭𝐚𝐬𝐡@{𝐧}` Applies the stash with index `𝐧`.
• 𝐏𝐨𝐩 𝐋𝐚𝐭𝐞𝐬𝐭 𝐒𝐭𝐚𝐬𝐡 (𝐀𝐩𝐩𝐥𝐲 𝐚𝐧𝐝 𝐃𝐫𝐨𝐩)
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐩𝐨𝐩` Applies the latest stash and removes it from the stash list.
• 𝐃𝐫𝐨𝐩 𝐚 𝐒𝐭𝐚𝐬𝐡
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐝𝐫𝐨𝐩` Removes the latest stash without applying it.
• 𝐃𝐫𝐨𝐩 𝐚 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜 𝐒𝐭𝐚𝐬𝐡
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐝𝐫𝐨𝐩 𝐬𝐭𝐚𝐬𝐡@{𝐧}` Removes the stash with index `𝐧`.
• 𝐂𝐥𝐞𝐚𝐫 𝐀𝐥𝐥 𝐒𝐭𝐚𝐬𝐡𝐞𝐬
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐜𝐥𝐞𝐚𝐫` Removes all stashes.
• 𝐂𝐫𝐞𝐚𝐭𝐞 𝐚 𝐍𝐞𝐰 𝐁𝐫𝐚𝐧𝐜𝐡 𝐚𝐧𝐝 𝐀𝐩𝐩𝐥𝐲 𝐒𝐭𝐚𝐬𝐡
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐛𝐫𝐚𝐧𝐜𝐡 <𝐧𝐞𝐰_𝐛𝐫𝐚𝐧𝐜𝐡_𝐧𝐚𝐦𝐞>` Creates a new branch and applies the latest stash to it.
• 𝐒𝐡𝐨𝐰 𝐂𝐡𝐚𝐧𝐠𝐞𝐬 𝐢𝐧 𝐚 𝐒𝐭𝐚𝐬𝐡
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐬𝐡𝐨𝐰 -𝐩 𝐬𝐭𝐚𝐬𝐡@{𝐧}` Shows the changes in a specific stash.
• 𝐀𝐩𝐩𝐥𝐲 𝐒𝐭𝐚𝐬𝐡 𝐰𝐢𝐭𝐡 𝐀𝐮𝐭𝐨-𝐌𝐞𝐫𝐠𝐞
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐚𝐩𝐩𝐥𝐲 — 3𝐰𝐚𝐲 𝐬𝐭𝐚𝐬𝐡@{𝐧}` Attempts to apply the stash using a 3-way merge.
• 𝐒𝐭𝐚𝐬𝐡 𝐎𝐧𝐥𝐲 𝐔𝐧𝐭𝐫𝐚𝐜𝐤𝐞𝐝 𝐅𝐢𝐥𝐞𝐬
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐬𝐚𝐯𝐞 — 𝐢𝐧𝐜𝐥𝐮𝐝𝐞-𝐮𝐧𝐭𝐫𝐚𝐜𝐤𝐞𝐝` Stashes only untracked files.
• 𝐒𝐭𝐚𝐬𝐡 𝐊𝐞𝐞𝐩𝐢𝐧𝐠 𝐈𝐧𝐝𝐞𝐱 𝐂𝐡𝐚𝐧𝐠𝐞𝐬
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐬𝐚𝐯𝐞 — 𝐤𝐞𝐞𝐩-𝐢𝐧𝐝𝐞𝐱` Stashes changes but keeps changes in the index.
• 𝐒𝐭𝐚𝐬𝐡 𝐂𝐡𝐚𝐧𝐠𝐞𝐬 𝐢𝐧𝐭𝐞𝐫𝐚𝐜𝐭𝐢𝐯𝐞𝐥𝐲
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐬𝐚𝐯𝐞 -𝐩` Allows you to interactively choose which changes to stash.
• 𝐀𝐩𝐩𝐥𝐲 𝐒𝐭𝐚𝐬𝐡 𝐚𝐬 𝐚 𝐌𝐞𝐫𝐠𝐞
`𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐚𝐩𝐩𝐥𝐲 -𝐦 <𝐦𝐞𝐫𝐠𝐞_𝐩𝐚𝐫𝐞𝐧𝐭_𝐧𝐮𝐦𝐛𝐞𝐫>` Applies the stash as a merge. Useful when the stash represents changes from a different branch.
 

Comments