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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Xavier F. Gouchet
April 04, 2018
Programming
27
0
Share
Git magic tricks
A lightning talks with a few Git configuration magic tricks
Xavier F. Gouchet
April 04, 2018
More Decks by Xavier F. Gouchet
See All by Xavier F. Gouchet
Writing a Kotlin Compiler Plugin
xgouchet
0
69
Being an ethical software engineer
xgouchet
0
340
Libérez votre créativité
xgouchet
0
160
Unleash your Programming Creativity
xgouchet
0
220
Demystifying the Test Pyramid
xgouchet
1
700
Successfully Publishing a Tested, Upgradeable and Documented Open Source Library
xgouchet
0
140
Property Based Testing in Practice
xgouchet
0
120
Develop your CI tools
xgouchet
2
490
How to write a safe and reliable Open Source Library
xgouchet
1
340
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
130
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
0
270
要はバランスからの卒業 #yumemi_grow
kajitack
0
190
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
110
AI時代だからこそ「Bloc」を採用する価値があるのかもしれない
takuroabe
0
230
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
5
610
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
980
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
230
Cloudflare で始める Data Platform
ta93abe
0
290
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
110
誰も頼んでない機能を出荷した話
zekutax
0
120
関係性から理解する"同一性"の型用語たち
pvcresin
2
510
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Writing Fast Ruby
sferik
630
63k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
KATA
mclloyd
PRO
35
15k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Building Applications with DynamoDB
mza
96
7k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
The SEO Collaboration Effect
kristinabergwall1
1
450
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.6k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
210
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
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