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
5
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
Being an ethical software engineer
xgouchet
PRO
0
250
Libérez votre créativité
xgouchet
PRO
0
110
Unleash your Programming Creativity
xgouchet
PRO
0
170
Demystifying the Test Pyramid
xgouchet
PRO
1
490
Successfully Publishing a Tested, Upgradeable and Documented Open Source Library
xgouchet
PRO
0
100
Property Based Testing in Practice
xgouchet
PRO
0
80
Develop your CI tools
xgouchet
PRO
2
400
How to write a safe and reliable Open Source Library
xgouchet
PRO
1
270
Benchmarking your app's performance
xgouchet
PRO
0
220
Other Decks in Programming
See All in Programming
「ElixirでIoT!!」のこれまでとこれから
takasehideki
0
370
0626 Findy Product Manager LT Night_高田スライド_speaker deck用
mana_takada
0
100
WindowInsetsだってテストしたい
ryunen344
1
190
童醫院敏捷轉型的實踐經驗
cclai999
0
190
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
570
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
800
Code as Context 〜 1にコードで 2にリンタ 34がなくて 5にルール? 〜
yodakeisuke
0
100
Deep Dive into ~/.claude/projects
hiragram
8
1.4k
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
1
120
Webの外へ飛び出せ NativePHPが切り拓くPHPの未来
takuyakatsusa
2
350
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
140
Is Xcode slowly dying out in 2025?
uetyo
1
190
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.1k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
Writing Fast Ruby
sferik
628
61k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
Rails Girls Zürich Keynote
gr2m
94
14k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
233
140k
Producing Creativity
orderedlist
PRO
346
40k
Why Our Code Smells
bkeepers
PRO
337
57k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
The Language of Interfaces
destraynor
158
25k
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