Use git stash
to temporarily save your uncommitted changes.
Steps:
- Make some changes to your files.
- Run
git status
to see that you have uncommitted changes. - Run
git stash
to save your uncommitted changes. - Make some more changes to your files.
- Run
git status
to see that you have uncommitted changes again. - Run
git stash list
to see your stashed changes. - Run
git stash apply
to apply your first stashed changes and restore your working directory to the state it was in before you rangit stash
. - Run
git stash pop
to apply your first stashed changes and delete them from the stash.
This trick can be useful if you need to temporarily switch to a different branch or work on another task without losing your uncommitted changes.
My Website: danyson.netlify.app
My LinkedIn: linkedin/danyson
Top comments (0)