Sunday | 23 JUN 2024
[ previous ]
[ next ]

Git in a Minute

Date: 2022-08-06

After reading a blog post about git in a minute, I figured I should jot down the git commands that I use. This is definitely a good way of distilling the core information.

This is what I would consider the most useful git commands :)

Start a git repo:

 git init

Add files

 git add --all


 git commit -m "message"

Add and commit

git commit -a -m "message"

List previous commits and their hashes

git log --pretty=oneline

Show a previous version

git show {hash}:/path/to/file

Roll back to a previous version

git checkout {hash} -- {filename}

Undo a commit

git reset HEAD^ 

Undo a specific commit

git reset {hash}