Need Assistance?

support@tutorialshub.in

Branches and Merging

Stashing unfinished work

ADVERTISEMENT
Git Free Lesson
5 min read
ADVERTISEMENT

What stash is for

Stash temporarily saves local modifications so you can return the working tree to a clean state. It is useful when you need to switch branches or perform another task before your current change is ready for a commit.

Stash is not a replacement for commits

A commit gives your work a durable, named point in history. A stash is better treated as temporary workspace storage. If work matters, a small temporary commit on a private branch can sometimes be safer and easier to recover.

Inspect before applying

List stashes and inspect their contents before applying one to a changed working tree. Applying a stash can itself produce conflicts if the surrounding code has changed.

ADVERTISEMENT