Willem Hoek

Most common Git commands

Jan 01, 2020

Basic commands

Copy (clone) your repositories (‘repo’) from remote (e.g. GitHub) to local pc.

git clone REPO_NAME

Add changes to staging area (Index), commit to local and push to remote.

git add .
git commit -m "notes"
git push 

Get updates (pull) and restore local tree

git pull
git restore *


git clean -i 
git reset
git branch
git log
git status
git config --global user.name "Your name" 
git config --global user.email your@email.com 


Managing SSH keys

On Windows. When using git with GitHub – you can set up your SSH keys to avoid typing in your GitHub username/password when working on your own repos:

To see if it all work, try this after adding key ssh -vT git@github.com


[1] Pro Git
The entire Pro Git book, written by Scott Chacon and Ben Straub is available online
https://git-scm.com/book/en/v2, Accessed 2020-03-11

Related Posts

Jane Street puzzle Feb 2021 SOLVED! OCaml to the rescue

Solving the Jane Street puzzle of Dec 2020 - Backtracking with OCaml

Automate your Jira reporting with Python and Excel

Solving the Jane Street Puzzle of June 2020; Circle Time

Solving the Jane Street Puzzle of May 2020; Expelled with OCaml

Never forget a birthday again with GitHub Actions and Python