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: An Illustrated Primer
Search
Daniel Cousineau
July 18, 2012
Programming
4
340
Git: An Illustrated Primer
Given at the July BCSPHP Meeting
Daniel Cousineau
July 18, 2012
Tweet
Share
More Decks by Daniel Cousineau
See All by Daniel Cousineau
Time is a Social Construct
dcousineau
1
440
React @ Scale
dcousineau
0
110
Frontend Performance & You
dcousineau
0
200
Feature Flags & You
dcousineau
2
80
React+Redux @ Scale
dcousineau
1
300
Reframing The Problem - DCJS July 2016
dcousineau
0
110
YAFT
dcousineau
2
150
Queues and the beanstalkd
dcousineau
1
610
How Not Writing PHP Makes You Better At PHP
dcousineau
0
360
Other Decks in Programming
See All in Programming
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
120
Outline View in SwiftUI
1024jp
1
280
AWS IaCの注目アップデート 2024年10月版
konokenj
3
3.2k
CSC509 Lecture 09
javiergs
PRO
0
140
カスタムしながら理解するGraphQL Connection
yanagii
1
1.5k
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.6k
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
720
リリース8年目のサービスの1800個のERBファイルをViewComponentに移行した方法とその結果
katty0324
5
4.2k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
160
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
4
1.9k
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The Cult of Friendly URLs
andyhume
78
6k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Producing Creativity
orderedlist
PRO
341
39k
BBQ
matthewcrist
85
9.3k
Building Adaptive Systems
keathley
38
2.3k
What's new in Ruby 2.0
geeforr
343
31k
Transcript
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com GIT:
An Illustrated Primer
http://mojolive.com/profile/dcousineau Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
History Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com BitKeeper
No Longer Free To Use Linux Kernel Requires Distributed Performant SVN and CVS... Not So Much “CVS is what we should NOT do...”
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com GIT
thus,
gItting started Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+OSX Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
http://git-scm.com
+OSX Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> /usr/bin/ruby -e \ "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)" $> brew install git $> say "Win!"
+Linux Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> sudo apt-get install git $> sudo yum install git $> echo "Seriously?"
+Windows Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
http://windows.github.com
+My First Repo Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Stage New Files Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Commit Staging Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+staging? Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory index repository
+staging? Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory index repository “staging”
+staging? Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory index repository modify
+staging? Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory index repository git add
+staging? Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory index repository git commit
+Directories Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Modify Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Branch! Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Back to Master Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Merge! Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+stashing Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Popping Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
branching Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com a
b c MASTER HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com a
b c MASTER DEVELOP create new branch HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com a
b c MASTER DEVELOP Checkout new branch HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com a
b c MASTER DEVELOP commit to develop d HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com commit
to master HEAD a b c MASTER DEVELOP d e
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com a
b c MASTER DEVELOP merge Develop d e f
Remote Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com SVN
GIT d e b a c d e b a c d d e b a c
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Create a Project Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Create a Project Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Doing as I am told Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+did as I was told Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+Push Again! Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+Fetching & Merging Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Pulling Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Two Authors Two Pushes Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
+Two Authors Two Pushes Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
+AFtermath Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Aftermath Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Aftermath Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+AFtermath Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+forking Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+pull requests Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+MAke Changes IN A NEW BRANCH Daniel Cousineau // follow
me : @dcousineau or http://dcousineau.com
+Push Changes Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+See Our New Branch Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
+Create Pull Request Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Oh Look, Our Pull Request Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+Oh Look Our Pull Request Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+Oh Look, It’s Merged In! Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+Remotes Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Adding Another Remote Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+create and sync new branches Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+Delete local and remote branches Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+Pull From One, Push To Another Daniel Cousineau // follow
me : @dcousineau or http://dcousineau.com
GIT FLow Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
http://nvie.com/posts/a-successful-git-branching-model/
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Subversion and GIT Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+et voilà Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com $> git svn clone -s -r 1000:HEAD https://url/to/repo ./wkngcpy $> git svn show-ignore > .gitignore
+Workflow Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Normal GIT Workflow
+Sync Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git svn dcommit --dry-run $> git svn dcommit $> git svn rebase
+With some caveats Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com anything that has been dcommit’d is set in stone! do. not. touch. git branches well svn... not so much
+Local Branching Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com $> git merge --squash branch
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com git
merge --squash localbrn HEAD a b c MASTER localbrn d e
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com git
merge --squash localbrn HEAD a b MASTER DEC
+Why? Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
SVN is TERRIBLE at merges git-svn will do it if you don’t and when it fails, it does so spectacularly you’ll just litter your commit history
+tracking svn branches Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com $> git checkout -t remotes/branchname
+creating remote branches Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com $> git svn branch -m “Creating new branch” branchname $> git checkout -t remotes/branchname
+personal opinion Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com except for release tagging and a develop branch don’t bother with remote branching just stick to local and squashes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com use
git svn locally push for team adoption procure git server full clone push to new git server
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com use
git svn locally push for team adoption procure git server full clone push to new git server
Advanced Usage Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+reset my local changes Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com $> git checkout -- . tell git “no more options!”
+Replay Last commit Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com $> git reset --mixed REF
+Gitting Ready Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+Results Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Undo Last commit Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com $> git reset --hard HEAD^ HEAD^ means commit prior to HEAD. HEAD^2 is 2 commits prior, etc etc.
+“Oops i forgot to branch” Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com $> git branch newbranchname $> git reset --hard SHA commit immediately before the intended first commit of our new branch
+“Oops i forgot to branch” Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+“Oops i forgot to branch” Daniel Cousineau // follow me
: @dcousineau or http://dcousineau.com
+“Oops I accidentally the commit message” Daniel Cousineau // follow
me : @dcousineau or http://dcousineau.com $> git rebase --interactive SHA commit immediately preceding the commit in question
+Oops Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Lay of the land Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
+Making decisions Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+Reach 88MPH Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+Fun with Paradoxes Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Fruits of our labor Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
+“Oops I committed the private key” Daniel Cousineau // follow
me : @dcousineau or http://dcousineau.com $> git filter-branch --index-filter \ 'git rm --cached --ignore-unmatch secret.key' \ --prune-empty --tag-name-filter cat -- --all ಠ_ಠ
+Terrible Mistake Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+gone now, here yesterday Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
+VooDoo Magic Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com
+Results Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Cleanup The Mess Daniel Cousineau // follow me : @dcousineau
or http://dcousineau.com
+Look Ma, No secret.key! Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
THANKS. FOR YOUR ATTENTION Daniel Cousineau // follow me :
@dcousineau or http://dcousineau.com
+further resources Daniel Cousineau // follow me : @dcousineau or
http://dcousineau.com http://git-scm.com/book FREE! Attribution-NonCommercial-ShareAlike 3.0 Unported https://help.github.com