How to save changes temporarily using git stash

Today we’ll show you how to save changes temporarily using git stash. Sometimes you might need to save your work temporarily. So you can use the git stash command to do it.

How to save changes temporarily using git stash, how to use git stash, git stash file, git stash untracked files, git stash committed changes, git stash no local changes to save, git stash apply specific file, git stash – temporary saving changes, git stashes as a temporary storage.

Different way to save changes using git stash

  1. Check list of stashed changes
  2. Save changes
  3. Save changes including untracked files
  4. Save changes with description
  5. Re-apply saved changes
  6. Re-apply saved changes and remove it from stash list

1. Check list of stashed changes

You can check stashed changes anytime by running the following command in the terminal.

2. Save changes

To save changes temporarily, you have to run the following command.

Above command will stash only modified files. It’ll not include untracked files.

3. Save changes including untracked files

To save changes including untracked files, run stash command along with --include-untracked. Check the following command.

OR

4. Save changes with description

It’s good practice to save changes with a small description. So that changes could be easy to identify. Use the command git stash save "message" to stashes with description.

5. Re-apply saved changes

To re-apply stashed changes, run the following command.

6. Re-apply saved changes and remove it from stash list

If you want to re-apply the stashed changes and also want to remove it from the stash list then you can use pop.

That’s it for today.
Thank you for reading. Happy Coding.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *