Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Practical git(lab)
Search
[email protected]
May 22, 2015
Programming
1
160
Practical git(lab)
Git best practices, tips & tricks. Talk given to my teammates at Ideaknow.
[email protected]
May 22, 2015
Tweet
Share
More Decks by
[email protected]
See All by
[email protected]
Making Xcode build times great again
xavierjurado
0
130
Practical Git(Hub)
xavierjurado
5
320
Programación concurrente con GCD
xavierjurado
1
170
Other Decks in Programming
See All in Programming
Google Antigravity and Vibe Coding: Agentic Development Guide
mickey_kubo
2
130
Level up your Gemini CLI - D&D Style!
palladius
1
180
【CA.ai #3】Google ADKを活用したAI Agent開発と運用知見
harappa80
0
270
AWS CDKの推しポイントN選
akihisaikeda
1
240
TVerのWeb内製化 - 開発スピードと品質を両立させるまでの道のり
techtver
PRO
3
1.4k
Microservices rules: What good looks like
cer
PRO
0
600
CSC305 Lecture 17
javiergs
PRO
0
270
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
11
7k
俺流レスポンシブコーディング 2025
tak_dcxi
13
8k
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
160
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
150
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
320
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
Music & Morning Musume
bryan
46
7k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
We Have a Design System, Now What?
morganepeng
54
7.9k
Automating Front-end Workflow
addyosmani
1371
200k
Six Lessons from altMBA
skipperchong
29
4.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Faster Mobile Websites
deanohume
310
31k
Building an army of robots
kneath
306
46k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
How STYLIGHT went responsive
nonsquared
100
5.9k
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!