KEMBAR78
Musmankkh Git Github | PDF | System Software | Linux
0% found this document useful (0 votes)
7 views3 pages

Musmankkh Git Github

This Git/Github Cheat Sheet provides essential commands for setup, configuration, and workflow management in Git. It covers initializing and cloning repositories, staging and committing changes, viewing history, branching, merging, collaboration, stashing changes, undoing actions, tagging, and maintenance. The document serves as a quick reference guide for users to effectively manage their Git repositories.

Uploaded by

msatish1107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

Musmankkh Git Github

This Git/Github Cheat Sheet provides essential commands for setup, configuration, and workflow management in Git. It covers initializing and cloning repositories, staging and committing changes, viewing history, branching, merging, collaboration, stashing changes, undoing actions, tagging, and maintenance. The document serves as a quick reference guide for users to effectively manage their Git repositories.

Uploaded by

msatish1107
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Git/Github Cheat Sheet

by Muhammad Usman Asghar (musmankkh) via cheatography.com/214866/cs/46788/

Setup & Config​uration

git config --global user.name "Your Name"


git config --global user.email "​you​@ex​amp​le.c​om​"
git config --global core.e​ditor "​vim​"
git config --global color.ui auto
git config --global alias.st status
git config --list
git config --get user.email

Initia​lizing & Cloning Repos

git init
git init <di​rec​tor​y>
git clone <ur​l>
git clone --branch <br​anc​h> <ur​l>

Stage & Commit Workflow

git status
git add <fi​le>
git add . or git add --all
git commit -m "​mes​sag​e"
git commit -a
git commit --amend

Viewing History & Differ​ences

git log
git log --oneline --graph --all
git log --follow <fi​le>
git log --auth​or=​"​Nam​e"
git log --sinc​e="2 weeks ago"
git diff
git diff --staged or --cached
git diff HEAD
git diff <co​mmi​t1> <co​mmi​t2>
git show <co​mmi​t>
git blame <fi​le>

By Muhammad Usman Published 25th July, 2025. Sponsored by ApolloPad.com


Asghar (musmankkh) Last updated 25th July, 2025. Everyone has a novel in them. Finish
Page 1 of 3. Yours!
https://apollopad.com
cheatography.com/musmankkh/
Git/Github Cheat Sheet
by Muhammad Usman Asghar (musmankkh) via cheatography.com/214866/cs/46788/

Branching & Merging

git branch
git branch -a
git branch -vv
git branch <na​me>
git branch -d <na​me>
git branch -r
git checkout <br​anc​h>
git checkout -b <ne​w>
git checkout -- <fi​le>
git merge <br​anc​h>
git rebase <br​anc​h>
git rebase -i HEAD~3

Remotes & Collab​oration

git remote -v
git remote add origin <ur​l>
git remote rename old new
git remote remove <na​me>
git fetch
git fetch --prune
git pull
git pull --rebase
git push origin <br​anc​h>
git push --all
git push --tags

Stashing Changes

git stash
git stash list
git stash apply
git stash pop
git stash drop
git stash clear

By Muhammad Usman Published 25th July, 2025. Sponsored by ApolloPad.com


Asghar (musmankkh) Last updated 25th July, 2025. Everyone has a novel in them. Finish
Page 2 of 3. Yours!
https://apollopad.com
cheatography.com/musmankkh/
Git/Github Cheat Sheet
by Muhammad Usman Asghar (musmankkh) via cheatography.com/214866/cs/46788/

Undo, Reset & Restore

git checkout -- <file>


git restore <fi​le>
git restore --staged <fi​le>
git reset <fi​le>
git reset --soft <co​mmi​t>
git reset --mixed <co​mmi​t>
git reset --hard <co​mmi​t>
git revert <co​mmi​t>

Tags & Releases

git tag
git tag <na​me>
git tag -a <na​me> -m "​mes​sag​e"
git push origin <ta​g>
git push origin --tags

Cleaning & Mainte​nance

git clean -n
git clean -f
git clean -fd
git gc
git prune
git fsck

By Muhammad Usman Published 25th July, 2025. Sponsored by ApolloPad.com


Asghar (musmankkh) Last updated 25th July, 2025. Everyone has a novel in them. Finish
Page 3 of 3. Yours!
https://apollopad.com
cheatography.com/musmankkh/

You might also like