My favorite Git Commands (1)

Yeshin Lee
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.
Lastest stashed commit get number zero like stack(LIFO).
  • 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. Like git 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.).

reflog shows all history about repository.
  • 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.

--

--

Yeshin Lee
Yeshin Lee

No responses yet