:: krowemoh

Thursday | 26 DEC 2024
Posts Links Other About Now

previous
next

Git in a Minute

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.

https://www.garyrobinson.net/2014/10/git-in-two-minutes-for-a-solo-developer.html

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

Start a git repo:

 git init

Add files

 git add --all

Commit

 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}