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
April 04, 2018
Programming
36
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
80
Being an ethical software engineer
xgouchet
0
350
Libérez votre créativité
xgouchet
0
180
Unleash your Programming Creativity
xgouchet
0
230
Demystifying the Test Pyramid
xgouchet
1
760
Successfully Publishing a Tested, Upgradeable and Documented Open Source Library
xgouchet
0
150
Property Based Testing in Practice
xgouchet
0
130
Develop your CI tools
xgouchet
2
510
How to write a safe and reliable Open Source Library
xgouchet
1
360
Other Decks in Programming
See All in Programming
今さら聞けない .NET CLI
htkym
0
200
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
250
プロポーザルを書いてもらう
pvcresin
0
560
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
390
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
1.1k
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
270
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
1
140
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.9k
VibeCodingからAgenticWorkflowへ
starfish719
0
650
5分で問診!Composer セキュリティ健康診断
codmoninc
0
1.1k
Google Apps Script で Ruby を動かす
kawahara
0
280
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
1
1.8k
Featured
See All Featured
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
390
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Google's AI Overviews - The New Search
badams
0
1.1k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
670
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
280
Raft: Consensus for Rubyists
vanstee
141
7.6k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
390
Tell your own story through comics
letsgokoyo
1
1k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
480
Code Reviewing Like a Champion
maltzj
528
40k
Statistics for Hackers
jakevdp
799
230k
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