Compare

git stash vs commit

How to choose between temporary local cleanup and recording real history.

Stash is for temporarily setting work aside without making it part of normal branch history. Commit is for recording work you want to keep, explain, and potentially share.

Use Stash When

You need to quickly clear your working tree to switch context.

The work is incomplete and not ready to become part of branch history yet.

Use Commit When

You want a durable checkpoint that belongs in project history.

You are ready to describe the change and possibly share it with others.

Rule of Thumb

Stash hides work temporarily. Commit records it intentionally.

Want the short version? Browse the compact sheet views and save the commands you use most into a Cheatbook.