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
Practical git(lab)
Search
[email protected]
May 22, 2015
Programming
180
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Practical git(lab)
Git best practices, tips & tricks. Talk given to my teammates at Ideaknow.
[email protected]
May 22, 2015
More Decks by
[email protected]
See All by
[email protected]
Making Xcode build times great again
xavierjurado
0
150
Practical Git(Hub)
xavierjurado
5
350
Programación concurrente con GCD
xavierjurado
1
190
Other Decks in Programming
See All in Programming
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.3k
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
370
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
350
AIエージェントで 変わるAndroid開発環境
takahirom
2
480
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
170
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
140
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.8k
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
820
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
460
霧の中の代数的エフェクト
funnyycat
1
320
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
190
なぜ関数型プログラミングで「型」と「証明」が語られるのか #fp_matsuri
kajitack
3
760
Featured
See All Featured
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
220
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
WCS-LA-2024
lcolladotor
0
680
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Deep Space Network (abreviated)
tonyrice
0
220
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
260
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
490
Technical Leadership for Architectural Decision Making
baasie
3
440
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Transcript
Practical git(lab) no theory today, I promise!
Best practices Tips & tricks Rebase & you Terminal hackery
❝ git gets easier once you get the basic idea
that branches are homeomorphic endofunctors mapping submanifolds of a Hilbert space ❞ -- The Internet
❝ SourceTree sucks ❞ -- Me
Best practices Good
commit commit often write good commit messages do not commit
unrelated changes together
commit commit often write good commit messages do not commit
unrelated changes together
branches anything in master is deployable anything in develop will
be delivered in the next release * feature-branches is where we should commit
branches anything in master is deployable anything in develop will
be delivered in the next release * feature-branches is where we should commit
* Well, unless the client calls in the last minute
to demand ask you politely to drop a feature because they fucked up had some issues on their side. Something that never happens. Ever. Nope. branches
branches It’s ok to have different branch schemes, depends on
client, project, technology… a common workflow > no workflow at all keep it simple or people won’t follow the scheme
.gitignore know and use .gitignore committed files cannot be ignored
(well, not easily) https://github.com/github/gitignore
git pull God kills a kitten every time you do
this: Merge branch 'develop_15.5' of gitlab.ideaknow.com:sab-3-0/bsmobil- translations into develop_15.5
None
git pull git pull is considered harmful git fetch origin
git rebase origin/develop git config --global pull.ff only when changes can’t be applied fast-forward:
git pull do it for the kittens if you need
to solve conflicts when pushing/ pulling, you are doing something wrong
merge request why? we all make errors find logic bugs
high quality code enforce readable code style enforce good commit history let people know what you are working on learn (both ways) fun
merge request revelation
merge request useful messages: “Can we make this more readable?”
“What would be a better name for this method?” “This needs to be refactored into smaller methods” “”
merge request be the first to review your own code
learn to criticise and to be criticised your work != you open a merge request at any time, even to discuss an upcoming feature
clean history
Tips & tricks
How do I… …search all of git history for a
string? git log --all -G <string>
How do I… …find the commit that broke my project?
git bisect start git bisect good git bisect bad
How do I… …save current changes for later use without
committing because you need to do something urgent? git stash git stash list git stash pop git stash apply
How do I… …revert a non-staged change? git checkout --
path/to/file/to/revert git checkout -- . …revert all non-staged changes (and nothing else)? ⚠ ⚠
How do I… …revert a staged change? git reset path/to/file/to/revert
git reset …revert all staged changes (and nothing else)?
How do I… …revert all staged and non-staged changes? (i.e.:
all non-committed changes) git reset --hard ⚠
How do I… …revert the last non-pushed commit? git reset
HEAD^ …revert/modify a previous non-pushed commit? git rebase -i <parent commit>
How do I… …revert a pushed change? git revert <commit
sha>
How do I… …copy an existing commit (from another branch
or another point in history) ? git cherry-pick <commit SHA>
How do I… …split changes in a single file into
multiple commits? git add -p <file>
How do I… …clean remote branches? git remote prune origin
git push origin --delete <branch_name> …delete a remote branch?
How do I… … remove untracked files and directories? git
clean -d -f ⚠
How do I… … show changes introduced by a commit?
git show <commit sha> … show changes introduced by a merge commit? git show -m <commit sha>
How do I… … find who the fuck wrote this
aberration? git blame path/to/aberration
Rebase & you
… rypress.com/tutorials/git/rebasing.html?
Terminal hackery
autocompletion & prompt brew install bash-completion brew install git
better git log git config --global alias.lg "log --color --graph
-- pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias! `wo` credits: https://twitter.com/_supermarin
Questions?
Thanks!