Git Cheat Sheet

Hello there!
Here I would like to share my most commonly used git commands and a few aliases to keep your console simple and beautiful by formatting.

Create

Create a new local repository

Clone an existing repository


Check Changes

Check all changes

Check status

Changes to tracked files

Log

Diff

Shortlog

Graphs

Show Log By Author


Stash

Add To Stash

Show Stash List

Pop Stash

Apply Spesific Stash

Drop Spesific Stash


Stage & Commit

Add all changes to next commit

Add file changes to next commit

Commit staged changes

Change the last commit

Change the last commit name


Branches & Tags

List all existing branches

Switch HEAD branch

Checkout to a remote branch

Create branch

Delete local branch

Delete origin branch

Tag current commit


Update & Publish

Download all changes

Upload all changes

Publish tags


Merge & Rebase

Merge into current HEAD

Rebase your current HEAD onto

Don’t rebase published commits!

Abort rebase

Continue rebase

Use your configured merge tool for conflicts

After solving conflicts mark as resolved


UNDO

Discard all tracked changes

Discard all local changes on working directory

Discard all local changes in file

Reset HEAD pointer into a previous commit


Advanced Stuff

Local Garbage Collection

Delete Old History (https://stackoverflow.com/a/41953383)

Check LFS

Editing Global Config File

Setting An Editor For Config File


Git Alias

Shortcut Git Status: Use ‘git st’ to show git status -sb

Formatting Git Log: Use ‘git ls’ to show log with colored format

Formatting Git Graph: Use ‘git graph’ to show log with colored format

Ignoring Files Locally

Leave a Reply