Use git stash to temporarily save your uncommitted changes.
Steps:
- Make some changes to your files.
- Run
git statusto see that you have uncommitted changes. - Run
git stashto save your uncommitted changes. - Make some more changes to your files.
- Run
git statusto see that you have uncommitted changes again. - Run
git stash listto see your stashed changes. - Run
git stash applyto apply your first stashed changes and restore your working directory to the state it was in before you rangit stash. - Run
git stash popto 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)