Git and Github Tutorial - Stashing Changes - Part 11

Hi, Today in iThePro we will learn how to use Git and how to use with Github to build software and develop it. In this part we will see how to stashing changes.

Saving changes in the stash:
The stash is a place where we can store temporarily without having to commit them to the repository.
It's a lot like putting things to later on.
The stash is a special area in git, and things that we putting there, they are a lot like commits.

Note: The stash only works with tracked files !

git stash save "The Message"
This will save the modified files into the stash with a message.

Viewing stashed changes:
git stash list
 This will show a list of files in the stash.
git stash show <stash@{0}>
This will shows us a static of the specific stash.
git stash show -p <stash@{0] >
 This will show a diff of the specific stash.

Retrieving stashed changes:
git stash pop <stash@{0}>
 This will put the stash back to the directory + remove it from the stash.
git stash apply <stash@{0}>
 This will apply the stash on the directory but without removing it from the stash.

Deleting stashed changes:
git stash drop <stash@{0}>
 This will delete the stash.
git stash clean
This will erase every thing from the stash.

See the Git and Github Tutorials.




Oussama Amri 21 years, security professional from Tunisia. Lover of computer science especially programming and secuirty. Follow me On :

Popular Posts Powered by Blogger.