0% found this document useful (0 votes)
4 views1 page

Github

This cheat sheet provides essential Git commands for managing commits, logs, and file tracking. It includes panic commands for undoing commits, methods for deleting and untracking files, and tips for customizing Git log outputs. Additionally, it offers guidance on creating Git aliases for quicker command access.

Uploaded by

daniel prastowo
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)
4 views1 page

Github

This cheat sheet provides essential Git commands for managing commits, logs, and file tracking. It includes panic commands for undoing commits, methods for deleting and untracking files, and tips for customizing Git log outputs. Additionally, it offers guidance on creating Git aliases for quicker command access.

Uploaded by

daniel prastowo
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/ 1

Github - Codeschool Git Real Cheat Sheet

by wdfelippe via cheatography.com/1952/cs/864/

PANIC Commands Custom git log output

git reset --soft Undo last commit, put %ad author date
HEAD^ changes into staging %an author name
git commit --amend Change the last %h SHA hash
-m "New Messag​e" commit
%s subject
git reset --hard Undo last commit and
%d ref names
HEAD^ all changes
Ex: git log --pret​ty=​for​mat​:"%h %ad- [%an] %s"
git reset --hard Undo last 2 commits
HEAD^^ and all changes
Pushing Faster

First time git push -u origin master


Deleting and untracking files
Then git push
Delete from file system git rm FILE.txt
and git Git will memorize the location you want to push
by first using the command -u
Delete from git ONLY git rm --cached
FILE.txt
Git Aliases
After that, you may commit to save the delete
change. Git lol (log git config --global alias.lol "log
with some --pret​ty=​oneline --

Better ways to show git log colors and abbr​ev-​commit --graph --


visual tree) deco​rat​e"
Colorizing Log git config --global
Custom git git config --global alias.m​ylog
color.ui true
output "log --pret​ty=​for​mat:'%h [%an]
One commit per line git log --pret​ty=​oneline %s' --grap​h"
Output log the way git log -- Git status via git config --global alias.st
you want pret​ty=​for​mat​:"%h %ad- git st status
[%an] %s"
Git checkout git config --global alias.co
Show log and git log --oneline -p via git co checkout
modified lines
Git branch via git config --global alias.br
Show log and git log --oneline --stat git br branch
insertions and
Git commit via git config --global alias.ci
deletes
git ci commit
Show log with a tree git log --oneline --graph
Create your own alias using the format:
visual
git config --global alias​.y​our​alias "y
​ our
repres​ent​ation
command, ommiting 'git'
Limit git log until git log --
some date unti​l=1.mi​nut​e.ago

Limit git log since git log --


some date sinc​e=1.da​y.ago

Range git log git log --


sinc​e=1.mo​nth.ago --
unti​l=2.we​eks.ago

Range git log with git log --sinc​e=2​000​-01-


specifc date 01 --unti​l=2​012​-12-21

By wdfelippe Published 17th March, 2013. Sponsored by Readability-Score.com


cheatography.com/wdfelippe/ Last updated 5th June, 2014. Measure your website readability!
Page 1 of 1. https://readability-score.com

You might also like