My favorite Git Commands (1)
2 min readFeb 27, 2024
1. git stash
When you need to make commit to the file you’re working on first or need to move the branch, But you don’t want to commit your work.
git stash
is pre-saving (not commit) your code.
Before using, Add commit to save changes.
git stash list
: Show stashed commit list.
git stash apply stash@{NUMBER}
: Apply stashed commit. Press Tab key show all of stashed commit list.git stash drop stash@{NUMBER}
: Delete specific stashed commit. Likegit stash apply
, Press Tab key shows all of stashed commit list.git stash clear
: Clear all of stashed commit list.
Learn more about git stash
, click to here.
2. git reflog
git reflog
, called reference log, is similar to git log
.
git log
shows , show public logs (like commits), git reflog
show all logs (include private commands: checkout, pull etc.).
git log
shows the current HEAD and its ancestry from your repo.git reflog
shows ordered list of the commits that HEAD has pointed to history that undo from your repo. It's stored separately to the commits themselves isn't part of the repo.
Learn more about git reflog
, click to here.