Git & GitHub Cheat Sheet
Git & GitHub Cheat Sheet
01
Cheatsheet
INSTALLATION & GUIS
Configuring user information used across all local repositories
By Sharjeel Faiq
Git & GitHub
02
Cheatsheet
SETUP
With platform-specific installers for Git, GitHub also provides
the ease of staying up-to-date with the latest releases of the
command line tool while providing a graphical user interface for
day-to-day interaction, review, and repository synchronization.
By Sharjeel Faiq
Git & GitHub
03
Cheatsheet
SETUP & INIT
Configuring user information, initializing and cloning
reapositories
git init
initialize an existing directory as a Git repository
By Sharjeel Faiq
Git & GitHub
04
Cheatsheet
STAGE & SNAPSHOT
Working with snapshots and the Git staging area
git status
show modified files in the working directory, staged
for your next commit
git diff
diff of what is changed but not staged
By Sharjeel Faiq
Git & GitHub
05
Cheatsheet
BRANCH & MERGE
Isolating work in branches, changing context, and integrating
changes
git branch
list your branches. a* will appear next to the
currently active branch
git checkout
switch to another branch and check it out into your
working directory
git log
show all commits in the current branch’s history
By Sharjeel Faiq
Git & GitHub
06
Cheatsheet
SHARE & UPDATE
Retrieving updates from another repository and updating
local repos
git pull
fetch and merge any commits from the tracking remote
branch
By Sharjeel Faiq
Git & GitHub
07
Cheatsheet
TRACKING PATH CHANGES
Versioning file removes and path changes
git rm [file]
delete the file from the project and stage the removal
for commit
By Sharjeel Faiq
Git & GitHub
08
Cheatsheet
REWRITE HISTORY
Rewriting branches, updating commits and clearing history
By Sharjeel Faiq
Git & GitHub
09
Cheatsheet
TEMPORARY COMMITS
Temporarily store modified, tracked files in order to change
branches
git stash
Save modified and staged changes
By Sharjeel Faiq
Git & GitHub
10
Cheatsheet
IGNORING PATTERNS
Preventing unintentional staging or committing of files
logs/
*.notes
pattern*/
Save a file with desired patterns as .gitignore with
either direct string matches or wildcard globs.
By Sharjeel Faiq
11
[email protected]
https://sharjeelfaiq.com
By Sharjeel Faiq