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
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
120
AI がコードを書く時代における新卒エンジニアの仕事風景 (2026) / New Graduate Engineers in the Era of AI Coding (2026)
sushichan044
0
210
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1k
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
150
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
300
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
130
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
840
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
100
関数型プログラミングのメリットって何だろう?
wanko_it
0
160
共通化で考えるべきは、実装より公開する型だった
codeegg
0
180
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
390
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
750
Un-Boring Meetings
codingconduct
0
340
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
340
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
Fireside Chat
paigeccino
42
4k
How to make the Groovebox
asonas
2
2.3k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
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!