SlideShare a Scribd company logo
GIT: Inter-Snapshot 
SeongJae Park <sj38.park@gmail.com>
This Speak Aims To... 
Understanding conceptual inside of git 
Grow up a little once again together
Software Is Alive: Keeps Changing
Life Of Files 
FileA ver 0 FileB ver 0
Life Of Files 
FileB Changed 
FileA ver 0 FileB ver 1
Life Of Files 
FileA Changed 
FileB ver 1 FileA ver 1
Life Of Files 
FileB Changed Again 
FileA ver 1 FileB ver 2
Life Of Files 
“I miss FileA ver 0!” 
“Build fail, why? from when?” 
FileA ver 1 FileB ver 2
Software Is Alive: Keeps Changing 
“How To Keep Software’s Moment?”
Software Is Alive: Keeps Changing 
“How To Keep Software’s Moment?” 
$ ls 
0213_1st.tar 
0239_2nd.tar.gzip 
0305_final.zip 
0307_final2.alz
Software Is Alive: Keeps Changing 
“How To Keep Software’s Moment?” 
$ ls 
0213_1st.tar 
0239_2nd.tar.gzip 
0305_final.zip 
0307_final2.alz We will find a version. We always have. 
http://nofilmschool.com/sites/default/files/styles/article_wide/public/interstellar.jpg?itok=PDUgBX9v
VCS: Version Control System 
Help software history managing 
Just remember, You SHOULD use it
CVCS vs DVCS 
Centralized vs Distributed 
Not detail for this time(not main focus)… 
Just remember, CVCS is EVIL
git 
Distributed Version Control System 
Developed For Kernel SCM By Linus Torvalds 
“Only wimps use tape backup: real men just upload their important stuff on ftp, 
and let the rest of the world mirror it ;)” - Linus Torvalds 
Just remember, cool programmer uses GIT
TL; DR 
Snapshot is a moment of the universe 
History is a sequence of snapshots 
Parallel universes exist 
http://i0.kym-cdn.com/photos/images/newsfeed/000/021/503/tldr_trollcat.jpg?1318992465
GIT: BASIC CONCEPT 
History is a Sequence of Snapshots
Snapshot 
A moment of the universe 
$ tar cf snapshot.tar ShinyProject/* 
http://imageserver.moviepilot.com/simpsons-couch-the-simpsons-futurama-crossover-s-couch-gag-gets-weird.png?width=2213&height=1660
History: a Sequence Of Snapshots 
$ ls snapshots/ 
ss.1.tar 
ss.2.tar 
ss.3.tar 
ss.4.tar 
ss.5.tar 
http://vintageprintable.swivelchairmedia.com/wp-content/uploads/2011/05/Animal-Stop-motion-Cat-Running-Stop-motion-780x395.jpg 
a history
Parallel Universes 
Well known theory ;) 
For detail, http://www.youtube.com/watch?v=Ywn2Lz5zmYg
Parallel Universes 
In short, a snapshot could have multiple 
parents/children 
Parallel histories
GIT: CONCEPT, IN 
DETAIL 
Conceptual Implementation
Working, Staging, Snapshot Dirs 
● Based on the snapshot concept, 
○ VCS could be implemented using 3 types of 
directories 
■ Working, Staging, Snapshot 
http://www.make-upstudio.com/files/images/trainingcenter/Large/LIndia-1-6.jpg 
http://studio.maginei.com/studioimages/studio.jpg 
http://venturebeat.com/wp-content/uploads/2012/05/snapshots.jpg
Working Directory 
Sandbox for your funny work, hack, anything 
Source code usually reside here 
http://www.make-upstudio.com/files/images/trainingcenter/Large/LIndia-1-6.jpg
Staging Directory 
Files to be captured in next snapshot 
http://studio.maginei.com/studioimages/studio.jpg
Snapshot Directory 
Whole snapshots reside here 
Every snapshot could be identified uniquely 
http://venturebeat.com/wp-content/uploads/2012/05/snapshots.jpg
Simple Example 
$ mkdir tars; cd tars 
$ echo 80 > sense_of_humor 
$ cp sense_of_humor ../staging/ 
$ tar cf ../snapshots/1st ../staging/* 
$ echo 65 > sense_of_humor 
$ tar cf ../snapshots/2nd ../staging/* 
$ tar xf ../snapshots/1st ./ 
https://pbs.twimg.com/media/B2W_L20CcAAtfGW.jpg:large
GIT: COMMANDS 
Conceptual Implementation of Commands
git init 
Create internal directories 
$ mkdir ./.git 
$ mkdir ./.git/snapshots 
$ mkdir ./.git/staging
git add <file path> 
Add files to staging directory 
$ cp <file path> ./.git/staging/
git commit 
Create a snapshot from staging dir 
$ tar cf ./git/snapshots/<unique id>  
./git/staging/*
Branch 
Pointer to latest snapshot of a history 
branch 
‘master’
Branch 
Pointer to latest snapshot of a history 
Follows subsequent snapshots automatically 
branch 
‘master’ 
branch 
‘master’
git branch <name> 
Create a branch with <name> 
Created branch follows current history 
(Below code does not implement history following feature, though) 
$ ln -S ./git/snapshots/<name>  
./git/snapshots/<id>
git checkout <id or branch> 
● Restore a snapshot <id> or <branch> is 
pointing on working directory 
● If <branch>, transit to the branch’s history 
○ <branch> will follows subsequent snapshots 
$ tar xf ./git/snapshots/<id> ./
GIT: PARALLEL HISTORIES 
There are parallel universes
Parallel Universes 
Well known theory ;) 
For detail, http://www.youtube.com/watch?v=Ywn2Lz5zmYg
Parallel Universes 
In short, a snapshot could have multiple 
parents/children 
Parallel histories
Parallel Universes 
In short, a snapshot could have multiple 
parents/children 
Parallel histories 
Parallel history 1
Parallel Universes 
In short, a snapshot could have multiple 
parents/children 
Parallel histories 
Parallel history 1 
Parallel history 2
Parallel Universes 
In short, a snapshot could have multiple 
parents/children 
Parallel histories 
Parallel history 1 
Parallel history 2 
Parallel history 3
Parallel Universes 
Branch is useful to manage parallel histories 
branch 
‘foo’ 
branch 
‘master’
GIT: SCENARIOS 
It’s easy if you know parallel universes
“Wait, I did something wrong!” 
Past can’t be fixed(Available, actually… though not recommended) 
http://therecordingrevolution.com/wordpress/wp-content/uploads/2011/08/mistakes.gif
“Wait, I did something wrong!” 
Past can’t be fixed(Available, actually… though not recommended) 
Go back and start again from new parallel 
universe(no time-machine paradox!) 
http://d36xcvrkegf0f1.cloudfront.net/images/worlds/2755/HomerTimeTravels.jpg
Scenario: Horrible Thing Committed 
branch A
Scenario: Horrible Thing Committed 
Make new branch from last sane snapshot 
branch A 
branch B
Scenario: Horrible Thing Committed 
Do things right in this time 
branch B 
branch A
Scenario: Horrible Thing Committed 
Life goes on... 
branch B 
branch A
git merge <other branch> 
Create new child snapshot of 
Currently checked out(HEAD) snapshot and 
<other branch> 
branch B 
branch A 
(HEAD) 
$ git merge branch_Br
git merge <other branch> 
Create new child snapshot of 
Currently checked out(HEAD) snapshot and 
<other branch> 
branch A 
(HEAD) 
branch B 
$ git merge branch_Br 
$
Topic Branch 
New branch for every new topic coding 
branch 
topic1 
branch 
topic2 
branch 
master
Topic Branch 
New branch for every new topic coding 
New topic could be progressed parallel easily 
branch 
topic1 
branch 
topic2 
branch 
master
Topic Branch 
New branch for every new topic coding 
New topic could be progressed parallel easily 
It could be discarded or merged easily 
branch 
topic1 
branch 
topic2 
branch 
master
Topic Branch: Scenario 
1. New feature required 
branch 
master
Topic Branch: Scenario 
1. New feature required 
a. Create a topic branch 
branch 
topic1 
branch 
master
Topic Branch: Scenario 
a. Create a topic branch and work on it 
branch 
topic1 
1. New feature required 
branch 
master
Topic Branch: Scenario 
1. New feature required 
a. Create a topic branch and work on it 
2. Critical bug found 
a. Create a topic branch 
branch 
topic2 
branch 
topic1 
branch 
master
Topic Branch: Scenario 
1. New feature required 
a. Create a topic branch and work on it 
2. Critical bug found 
a. Create a topic branch and work on it 
branch 
topic1 
branch 
topic2 
branch 
master
Topic Branch: Scenario 
1. New feature required 
a. Create a topic branch and work on it 
2. Critical bug found 
a. Create a topic branch and work on it 
3. Merge finished branch 
branch 
topic1 
branch 
topic2 
branch 
master
git rebase --onto <new base> <from> <to> 
Apply changes from <from> to <to> on <new 
base> and checkout applied snapshot 
a b c d e f 
branch “from” 
g h branch “to” 
branch 
“new_base”
git rebase --onto <new base> <from> <to> 
Apply changes from <from> to <to> on <new 
base> and checkout applied snapshot 
a b c d e f 
g h branch “to” 
branch 
“new_base” 
branch “from” 
h’
GIT: REMOTE 
Inter-stellar git repositories
Remote Repository 
● Just Other’s snapshots directory 
● It could be connected via 
○ file system 
○ http protocol 
○ https protocol 
○ ssh protocol 
○ git protocol
git clone <remote repo path> 
Just fetch <remote repo> and checkout master 
branch of it 
The <remote repo> be named as ‘origin’ by 
default
git fetch <remote> 
Fetch <remote>’s snapshots to local repo 
<remote> is ‘origin’ by default 
cp <remote>/.git/snapshots/* ./git/snapshots/
git pull 
Just git fetch && git merge
git push <remote> <branch> 
Push <branch>’s snapshots to <remote>
Free GIT Repo Hosting Service 
● GitHub 
○ Popular service 
○ Money for private repository 
● Bitbucket 
○ Popular, though less than GitHub 
○ Free for restricted private repositories 
● GitLab 
○ GitHub like rich-features 
○ Installable on your private machine 
○ No limitation at all
Thank you :) 
http://jeancharpentier.files.wordpress.com/2012/02/capture-plein-c3a9cran-01022012-230955.jpg
This work by SeongJae Park is licensed under the 
Creative Commons Attribution-ShareAlike 3.0 Unported 
License. To view a copy of this license, visit http: 
//creativecommons.org/licenses/by-sa/3.0/.

More Related Content

PDF
DO YOU WANT TO USE A VCS
PDF
Let the contribution begin
PDF
Git internals
PDF
Git & Github for beginners
PDF
Let the contribution begin (EST futures)
PDF
Introduction to Git for Non-Developers
KEY
Git Basics - RubyFest 2009
PDF
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
DO YOU WANT TO USE A VCS
Let the contribution begin
Git internals
Git & Github for beginners
Let the contribution begin (EST futures)
Introduction to Git for Non-Developers
Git Basics - RubyFest 2009
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...

What's hot (20)

PDF
いつやるの?Git入門
PDF
JPA 스터디 Week1 - 하이버네이트, 캐시
PDF
Git - a powerful version control tool
PDF
Advanced Git Tutorial
PPTX
PDF
Inside GitHub with Chris Wanstrath
PDF
Git 101 tutorial presentation
KEY
The everyday developer's guide to version control with Git
PDF
Tracking large game assets with Git LFS
PDF
Version Control and Git - GitHub Workshop
PDF
Tracking huge files with Git LFS (GlueCon 2016)
PDF
GREAT STEP 1. 테스트 코드를 향한 위대한 발걸음
KEY
Git and GitHub
PDF
[로켓 자바] Part 1 성능 튜닝 마인드 확립
PDF
Git & GitHub for Beginners
PDF
Git Real
PDF
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
PDF
Starting with Git & GitHub
PDF
Git training
PDF
GitGot: The Swiss Army Chainsaw of Git Repo Management
いつやるの?Git入門
JPA 스터디 Week1 - 하이버네이트, 캐시
Git - a powerful version control tool
Advanced Git Tutorial
Inside GitHub with Chris Wanstrath
Git 101 tutorial presentation
The everyday developer's guide to version control with Git
Tracking large game assets with Git LFS
Version Control and Git - GitHub Workshop
Tracking huge files with Git LFS (GlueCon 2016)
GREAT STEP 1. 테스트 코드를 향한 위대한 발걸음
Git and GitHub
[로켓 자바] Part 1 성능 튜닝 마인드 확립
Git & GitHub for Beginners
Git Real
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Starting with Git & GitHub
Git training
GitGot: The Swiss Army Chainsaw of Git Repo Management
Ad

Viewers also liked (10)

PDF
Porting golang development environment developed with golang
PDF
An introduction to_golang.avi
PDF
gcma: guaranteed contiguous memory allocator
PDF
Deep dark side of git - prologue
PDF
(Live) build and run golang web server on android.avi
PDF
Develop Android/iOS app using golang
PDF
Sw install with_without_docker
PDF
Understanding of linux kernel memory model
PDF
Deep dark-side of git: How git works internally
PDF
Develop Android app using Golang
Porting golang development environment developed with golang
An introduction to_golang.avi
gcma: guaranteed contiguous memory allocator
Deep dark side of git - prologue
(Live) build and run golang web server on android.avi
Develop Android/iOS app using golang
Sw install with_without_docker
Understanding of linux kernel memory model
Deep dark-side of git: How git works internally
Develop Android app using Golang
Ad

Similar to Git inter-snapshot public (20)

ODP
How to use git without rage
PPTX
Using Git as your VCS with Bioconductor
ODP
Introduction to Git (Greg Lonnon)
PDF
Git Anti-Patterns: How To Mess Up With Git and Love it Again
PPTX
Git-ing out of your git messes
PDF
That's (g)it! par Sébastien Dawans CETIC
PDF
Introduction to Git
PDF
Loading...git
PDF
Git Anti Patterns - XP Days Ukraine 2017
PPT
390a gitintro 12au
KEY
Git Tech Talk
PDF
Honestly Git Playground 20190221
PPTX
KEY
Git Distributed Version Control System
ODP
Introduction of Git
PPTX
Intro to Git DevOps Tally Presentation 101615
PDF
Introduction to git, an efficient distributed version control system
PPTX
YET ANOTHER INTRODCTION AND AN EXAMPLE HOW NOT TO USE BAD PRESENTATION STYLES
PDF
How to Really Get Git
How to use git without rage
Using Git as your VCS with Bioconductor
Introduction to Git (Greg Lonnon)
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git-ing out of your git messes
That's (g)it! par Sébastien Dawans CETIC
Introduction to Git
Loading...git
Git Anti Patterns - XP Days Ukraine 2017
390a gitintro 12au
Git Tech Talk
Honestly Git Playground 20190221
Git Distributed Version Control System
Introduction of Git
Intro to Git DevOps Tally Presentation 101615
Introduction to git, an efficient distributed version control system
YET ANOTHER INTRODCTION AND AN EXAMPLE HOW NOT TO USE BAD PRESENTATION STYLES
How to Really Get Git

More from SeongJae Park (11)

PDF
Biscuit: an operating system written in go
PDF
GCMA: Guaranteed Contiguous Memory Allocator
PDF
Linux Kernel Memory Model
PDF
An Introduction to the Formalised Memory Model for Linux Kernel
PDF
Design choices of golang for high scalability
PDF
Brief introduction to kselftest
PDF
Experimental android hacking using reflection
PDF
Hacktime for adk
PDF
Touch Android Without Touching
PDF
AOSP에 컨트리뷰션 하기 dev festx korea 2012 presentation
Biscuit: an operating system written in go
GCMA: Guaranteed Contiguous Memory Allocator
Linux Kernel Memory Model
An Introduction to the Formalised Memory Model for Linux Kernel
Design choices of golang for high scalability
Brief introduction to kselftest
Experimental android hacking using reflection
Hacktime for adk
Touch Android Without Touching
AOSP에 컨트리뷰션 하기 dev festx korea 2012 presentation

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Electronic commerce courselecture one. Pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Machine learning based COVID-19 study performance prediction
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation theory and applications.pdf
Cloud computing and distributed systems.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
“AI and Expert System Decision Support & Business Intelligence Systems”
MIND Revenue Release Quarter 2 2025 Press Release
Electronic commerce courselecture one. Pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Spectral efficient network and resource selection model in 5G networks
NewMind AI Weekly Chronicles - August'25 Week I
Machine learning based COVID-19 study performance prediction
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The AUB Centre for AI in Media Proposal.docx
Per capita expenditure prediction using model stacking based on satellite ima...
Advanced methodologies resolving dimensionality complications for autism neur...
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation theory and applications.pdf

Git inter-snapshot public

  • 1. GIT: Inter-Snapshot SeongJae Park <sj38.park@gmail.com>
  • 2. This Speak Aims To... Understanding conceptual inside of git Grow up a little once again together
  • 3. Software Is Alive: Keeps Changing
  • 4. Life Of Files FileA ver 0 FileB ver 0
  • 5. Life Of Files FileB Changed FileA ver 0 FileB ver 1
  • 6. Life Of Files FileA Changed FileB ver 1 FileA ver 1
  • 7. Life Of Files FileB Changed Again FileA ver 1 FileB ver 2
  • 8. Life Of Files “I miss FileA ver 0!” “Build fail, why? from when?” FileA ver 1 FileB ver 2
  • 9. Software Is Alive: Keeps Changing “How To Keep Software’s Moment?”
  • 10. Software Is Alive: Keeps Changing “How To Keep Software’s Moment?” $ ls 0213_1st.tar 0239_2nd.tar.gzip 0305_final.zip 0307_final2.alz
  • 11. Software Is Alive: Keeps Changing “How To Keep Software’s Moment?” $ ls 0213_1st.tar 0239_2nd.tar.gzip 0305_final.zip 0307_final2.alz We will find a version. We always have. http://nofilmschool.com/sites/default/files/styles/article_wide/public/interstellar.jpg?itok=PDUgBX9v
  • 12. VCS: Version Control System Help software history managing Just remember, You SHOULD use it
  • 13. CVCS vs DVCS Centralized vs Distributed Not detail for this time(not main focus)… Just remember, CVCS is EVIL
  • 14. git Distributed Version Control System Developed For Kernel SCM By Linus Torvalds “Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it ;)” - Linus Torvalds Just remember, cool programmer uses GIT
  • 15. TL; DR Snapshot is a moment of the universe History is a sequence of snapshots Parallel universes exist http://i0.kym-cdn.com/photos/images/newsfeed/000/021/503/tldr_trollcat.jpg?1318992465
  • 16. GIT: BASIC CONCEPT History is a Sequence of Snapshots
  • 17. Snapshot A moment of the universe $ tar cf snapshot.tar ShinyProject/* http://imageserver.moviepilot.com/simpsons-couch-the-simpsons-futurama-crossover-s-couch-gag-gets-weird.png?width=2213&height=1660
  • 18. History: a Sequence Of Snapshots $ ls snapshots/ ss.1.tar ss.2.tar ss.3.tar ss.4.tar ss.5.tar http://vintageprintable.swivelchairmedia.com/wp-content/uploads/2011/05/Animal-Stop-motion-Cat-Running-Stop-motion-780x395.jpg a history
  • 19. Parallel Universes Well known theory ;) For detail, http://www.youtube.com/watch?v=Ywn2Lz5zmYg
  • 20. Parallel Universes In short, a snapshot could have multiple parents/children Parallel histories
  • 21. GIT: CONCEPT, IN DETAIL Conceptual Implementation
  • 22. Working, Staging, Snapshot Dirs ● Based on the snapshot concept, ○ VCS could be implemented using 3 types of directories ■ Working, Staging, Snapshot http://www.make-upstudio.com/files/images/trainingcenter/Large/LIndia-1-6.jpg http://studio.maginei.com/studioimages/studio.jpg http://venturebeat.com/wp-content/uploads/2012/05/snapshots.jpg
  • 23. Working Directory Sandbox for your funny work, hack, anything Source code usually reside here http://www.make-upstudio.com/files/images/trainingcenter/Large/LIndia-1-6.jpg
  • 24. Staging Directory Files to be captured in next snapshot http://studio.maginei.com/studioimages/studio.jpg
  • 25. Snapshot Directory Whole snapshots reside here Every snapshot could be identified uniquely http://venturebeat.com/wp-content/uploads/2012/05/snapshots.jpg
  • 26. Simple Example $ mkdir tars; cd tars $ echo 80 > sense_of_humor $ cp sense_of_humor ../staging/ $ tar cf ../snapshots/1st ../staging/* $ echo 65 > sense_of_humor $ tar cf ../snapshots/2nd ../staging/* $ tar xf ../snapshots/1st ./ https://pbs.twimg.com/media/B2W_L20CcAAtfGW.jpg:large
  • 27. GIT: COMMANDS Conceptual Implementation of Commands
  • 28. git init Create internal directories $ mkdir ./.git $ mkdir ./.git/snapshots $ mkdir ./.git/staging
  • 29. git add <file path> Add files to staging directory $ cp <file path> ./.git/staging/
  • 30. git commit Create a snapshot from staging dir $ tar cf ./git/snapshots/<unique id> ./git/staging/*
  • 31. Branch Pointer to latest snapshot of a history branch ‘master’
  • 32. Branch Pointer to latest snapshot of a history Follows subsequent snapshots automatically branch ‘master’ branch ‘master’
  • 33. git branch <name> Create a branch with <name> Created branch follows current history (Below code does not implement history following feature, though) $ ln -S ./git/snapshots/<name> ./git/snapshots/<id>
  • 34. git checkout <id or branch> ● Restore a snapshot <id> or <branch> is pointing on working directory ● If <branch>, transit to the branch’s history ○ <branch> will follows subsequent snapshots $ tar xf ./git/snapshots/<id> ./
  • 35. GIT: PARALLEL HISTORIES There are parallel universes
  • 36. Parallel Universes Well known theory ;) For detail, http://www.youtube.com/watch?v=Ywn2Lz5zmYg
  • 37. Parallel Universes In short, a snapshot could have multiple parents/children Parallel histories
  • 38. Parallel Universes In short, a snapshot could have multiple parents/children Parallel histories Parallel history 1
  • 39. Parallel Universes In short, a snapshot could have multiple parents/children Parallel histories Parallel history 1 Parallel history 2
  • 40. Parallel Universes In short, a snapshot could have multiple parents/children Parallel histories Parallel history 1 Parallel history 2 Parallel history 3
  • 41. Parallel Universes Branch is useful to manage parallel histories branch ‘foo’ branch ‘master’
  • 42. GIT: SCENARIOS It’s easy if you know parallel universes
  • 43. “Wait, I did something wrong!” Past can’t be fixed(Available, actually… though not recommended) http://therecordingrevolution.com/wordpress/wp-content/uploads/2011/08/mistakes.gif
  • 44. “Wait, I did something wrong!” Past can’t be fixed(Available, actually… though not recommended) Go back and start again from new parallel universe(no time-machine paradox!) http://d36xcvrkegf0f1.cloudfront.net/images/worlds/2755/HomerTimeTravels.jpg
  • 45. Scenario: Horrible Thing Committed branch A
  • 46. Scenario: Horrible Thing Committed Make new branch from last sane snapshot branch A branch B
  • 47. Scenario: Horrible Thing Committed Do things right in this time branch B branch A
  • 48. Scenario: Horrible Thing Committed Life goes on... branch B branch A
  • 49. git merge <other branch> Create new child snapshot of Currently checked out(HEAD) snapshot and <other branch> branch B branch A (HEAD) $ git merge branch_Br
  • 50. git merge <other branch> Create new child snapshot of Currently checked out(HEAD) snapshot and <other branch> branch A (HEAD) branch B $ git merge branch_Br $
  • 51. Topic Branch New branch for every new topic coding branch topic1 branch topic2 branch master
  • 52. Topic Branch New branch for every new topic coding New topic could be progressed parallel easily branch topic1 branch topic2 branch master
  • 53. Topic Branch New branch for every new topic coding New topic could be progressed parallel easily It could be discarded or merged easily branch topic1 branch topic2 branch master
  • 54. Topic Branch: Scenario 1. New feature required branch master
  • 55. Topic Branch: Scenario 1. New feature required a. Create a topic branch branch topic1 branch master
  • 56. Topic Branch: Scenario a. Create a topic branch and work on it branch topic1 1. New feature required branch master
  • 57. Topic Branch: Scenario 1. New feature required a. Create a topic branch and work on it 2. Critical bug found a. Create a topic branch branch topic2 branch topic1 branch master
  • 58. Topic Branch: Scenario 1. New feature required a. Create a topic branch and work on it 2. Critical bug found a. Create a topic branch and work on it branch topic1 branch topic2 branch master
  • 59. Topic Branch: Scenario 1. New feature required a. Create a topic branch and work on it 2. Critical bug found a. Create a topic branch and work on it 3. Merge finished branch branch topic1 branch topic2 branch master
  • 60. git rebase --onto <new base> <from> <to> Apply changes from <from> to <to> on <new base> and checkout applied snapshot a b c d e f branch “from” g h branch “to” branch “new_base”
  • 61. git rebase --onto <new base> <from> <to> Apply changes from <from> to <to> on <new base> and checkout applied snapshot a b c d e f g h branch “to” branch “new_base” branch “from” h’
  • 62. GIT: REMOTE Inter-stellar git repositories
  • 63. Remote Repository ● Just Other’s snapshots directory ● It could be connected via ○ file system ○ http protocol ○ https protocol ○ ssh protocol ○ git protocol
  • 64. git clone <remote repo path> Just fetch <remote repo> and checkout master branch of it The <remote repo> be named as ‘origin’ by default
  • 65. git fetch <remote> Fetch <remote>’s snapshots to local repo <remote> is ‘origin’ by default cp <remote>/.git/snapshots/* ./git/snapshots/
  • 66. git pull Just git fetch && git merge
  • 67. git push <remote> <branch> Push <branch>’s snapshots to <remote>
  • 68. Free GIT Repo Hosting Service ● GitHub ○ Popular service ○ Money for private repository ● Bitbucket ○ Popular, though less than GitHub ○ Free for restricted private repositories ● GitLab ○ GitHub like rich-features ○ Installable on your private machine ○ No limitation at all
  • 69. Thank you :) http://jeancharpentier.files.wordpress.com/2012/02/capture-plein-c3a9cran-01022012-230955.jpg
  • 70. This work by SeongJae Park is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http: //creativecommons.org/licenses/by-sa/3.0/.