Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Git magic tricks
Search
Xavier F. Gouchet
PRO
April 04, 2018
Programming
0
17
Git magic tricks
A lightning talks with a few Git configuration magic tricks
Xavier F. Gouchet
PRO
April 04, 2018
Tweet
Share
More Decks by Xavier F. Gouchet
See All by Xavier F. Gouchet
Writing a Kotlin Compiler Plugin
xgouchet
PRO
0
56
Being an ethical software engineer
xgouchet
PRO
0
320
Libérez votre créativité
xgouchet
PRO
0
140
Unleash your Programming Creativity
xgouchet
PRO
0
210
Demystifying the Test Pyramid
xgouchet
PRO
1
650
Successfully Publishing a Tested, Upgradeable and Documented Open Source Library
xgouchet
PRO
0
130
Property Based Testing in Practice
xgouchet
PRO
0
100
Develop your CI tools
xgouchet
PRO
2
460
How to write a safe and reliable Open Source Library
xgouchet
PRO
1
320
Other Decks in Programming
See All in Programming
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
340
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
440
20260228_JAWS_Beginner_Kansai
takuyay0ne
3
270
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
490
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
120
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
200
atmaCup #23でAIコーディングを活用した話
ml_bear
4
700
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
190
Event Storming
hschwentner
3
1.3k
Oxlint JS plugins
kazupon
1
1.1k
CSC307 Lecture 13
javiergs
PRO
0
310
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1.1k
Featured
See All Featured
Music & Morning Musume
bryan
47
7.1k
A Soul's Torment
seathinner
5
2.4k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
810
How to build a perfect <img>
jonoalderson
1
5.2k
WENDY [Excerpt]
tessaabrams
9
36k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
59
50k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
760
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.1k
Statistics for Hackers
jakevdp
799
230k
Building Applications with DynamoDB
mza
96
6.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Transcript
GIT MAGIC TRICKS CodeMobile UK 2018 1
ABOUT… XAVIER F. GOUCHET LEAD ANDROID ENGINEER AT WORKWELL FLUENT
IN ANDROID SINCE CUPCAKE ON ALL SOCIAL NETWORKS @XGOUCHET 2
FOREWORD EDIT THE CONFIG FILES : Local: /…/repo/.git/config Global (per
user) : ~/.gitconfig System : /etc/gitconfig [group] property = value 3
IN THE TERMINAL $ git config group.property "Foo" $ git
config --global group.property "Bar" $ git config --system group.property "Baz" 4
ALIASES [alias] lg = log --pretty=format:"%Cyellow%h %ad %Cwhite%s" $ git
lg 5
YOU'RE HERE ↓ [alias] # WTF was I working on
earlier… ? wtf = "!git status --short --branch; echo -e '\nThe last 3 commits was :'; git lg -3 --numstat" 6
SHORT TERM MEMORY LOSS [alias] # log only my commits
mine = lg --author="$(git config user.email)" # log my commits since yesterday standup = !git mine --since yesterday 7
TAKE OUT THE TRASH [alias] # dmb = delete-merged-branches dmb
= "!git branch --no-color --merged | egrep -v "(^\*|master|develop)" | xargs -I{} git branch -d {}" 8
WHAT'S UP, DOC ? [alias] update = "!git pull -r
&& git dmb && git wtf" sync = "!git pull -r && git push" 9
REWRITING HISTORY [alias] # Amend last commit amend = commit
--amend # Amend without prompting for a message update comend = commit --amend --no-edit # Create a fixup commit (git fixup 35d15a2) fixup = commit --fixup 10
CAN I HAVE SOME MORE, PLEASE ? [alias] # never
push force ! please = push --force-with-lease 11
TO ERR IS HUMAN, BUT A REAL DISASTER NEEDS A
GIT CLIENT [alias] # undo `git [add|rm] …` unstage = reset --mixed # undo `git commit …`, keep the changes uncommit = reset --soft HEAD^ # undo `git commit …`, drop the changes ⚠ rollback = reset --hard HEAD^ 12
I HAVE SEXDAILY... DISLEXIA... DAMN AUTOCORRECT! [help] # execute the
mistyped command after 50 deciseconds (5s) autoCorrect = 50 [alias] cehcout = checkout cmomit = commit 13
AN ACCIDENT WAITING TO HAPPEN “Some fixes.” “Should work now…
I think” “You won't believe what this developer did to fix the bug !” [alias] yolo = "!git add -a && commit -m "$(curl -s whatthecommit.com/index.txt)" 14
WANT MORE ? 🔎 .gitconfig on GitHub gists 🔎 git
aliases on GitHub or just Google If you type it more than twice, make an alias of it 15
DEMO TIME 16
DEMO TIME 17
QUESTIONS 18
QUESTIONS 19
GIT HOOKS 20
GIT HOOKS NEXT TIME… MAYBE ? THANK YOU FOR YOUR
ATTENTION 21