Show Menu
Cheatography

git Cheat Sheet (DRAFT) by

Standard git Concepts

This is a draft cheat sheet. It is a work in progress and is not finished yet.

git checkout

git checkout <branch>

Restore working tree files

git restore <FILE_PATH>

View commands of HEAD changes on branch

git reflog
 

Mannage branches on the repo (git branch)

git branch

# List all remote branches
git branch -r

# Rename current branch
git branch -m new-name

# Rename a specific branch
git branch -m old-name new-name

# If already pushed, update remote
git push origin -u new-name
git push origin --delete old-name
If a branch gets renamed locally, this name change will not be reflected on the remote. One will need to change this.
 

git fetch

git fetch <branch-name>
git fetch downloads commits, branches, and tags from a remote repository into your local repo — but does not modify your working directory or current branch.