How to stash changes in git



When you do some work on a branch, but need to switch branches to do some work, but don't want to commit the current changes, you can try this command, save the unfinished changes to a stack, you can do any time at any time. Enable these changes on the branch.


 git stash push -m "add file"


 git stash push -m "add file"


git :    is a free and open source distributed version control system
stash :    stash changes in dirty working directory
push :    save local modifications to a new stash entry and roll them back to HEAD (in the working tree and index
-m, --message <message> :    stash message


Saved working directory and index state On master: add file
Was this helpful?

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.