SlideShare a Scribd company logo
Business Informatics Group
Institute of Software Technology and Interactive Systems
Vienna University of Technology
Favoritenstraße 9-11/188-3, 1040 Vienna, Austria
phone: +43 (1) 58801-18804 (secretary), fax: +43 (1) 58801-18896
office@big.tuwien.ac.at, www.big.tuwien.ac.at
A Brief Introduction to Working with Git
10.03.2014
VUT, Vienna, Austria
Philip Langer
History of Versioning Systems
Based on http://codicesoftware.blogspot.com/2010/11/version-control-
timeline.html
local to central …
central to distributed …
1972
sccs
discourage branching …
everything is a branch …
Git: A Distributed Versioning System
 There is no single repository server
 Every peer is a full repository instance
 Single-peer versioning possible
 Including the complete history
 Committing changes is independent of peers
 Allows disconnected operation
 Collaboration is done by pushing/pulling commits
 Comparable to peer-to-peer networks
 The role of peers is purely organizational
 No technical difference among peers
 Single common central server possible
 One peer happens to be the central repo
 But several other architectures are possible too
 Gate-keeper architecture
 Teams of teams
3
commit
push & pull
push & pull
push & pull
<Bob>
<Alice>
<Sally>
<Server>
<Harry>
push & pull
The Four Layers & Transferring Changes Among Them
 Every repository consists of a
 Workspace
 Index (“staging area”)
 Local repository
 Remote repositories
 …
 Transferring changes
 git add
 workspace to index
 git commit
 index to local branch
 git push
 local branch to remote branch
 …
 Changes are organized in commits
 Each commit has a parent
 The history is basically a DAG
4
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
5
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
6
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
7
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard HEAD~
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
8
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard HEAD~
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
9
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
!
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
10
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
11
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Reset index
after wrong
add
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed] HEAD~
 History and index
 git reset --soft
 Only history
 …
12
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed] HEAD~
 History and index
 git reset --soft
 Only history
 …
13
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Undo last
commit, however
it‘s still there
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft
 Only history
 …
14
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Does nothing
actualy
(HEAD is default)
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft HEAD~
 Only history
 …
15
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is HEAD?
 A reference pointing to the last commit (of the current branch)
 Thus, it will be the parent of the next commit
 Relative commit expressions e.g. with HEAD~2
 git reset [--soft | --mixed | --hard] [commit | reference to commit]
 Resets HEAD in history, index, and/or workspace to [commit]
 git reset --hard
 History, index, and workspace
 git reset [--mixed]
 History and index
 git reset --soft HEAD~
 Only history
 …
16
default:
HEAD
default:
--mixed
History
Index
Workspace
Head
Undo last
commit, leaving
index untouched
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is checkout?
 Get a version from the history
 And overwrite workspace
 (also for creating and changing branches … later)
 git checkout -- <file/s>
 Get version of <file/s> from HEAD
 Overwrite version in workspace
17
History
Index
Workspace
Head
Undo last
commit, leaving
index untouched
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is checkout?
 Get a version from the history
 And overwrite workspace
 (also for creating and changing branches … later)
 git checkout -- <file/s>
 Get version of <file/s> from HEAD
 Overwrite version in workspace
18
History
Index
Workspace
Head
Undo local
changes to
workspace.
!
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is revert?
 Does not modify history (good if you pushed already)
 Takes a commit from history
 Creates reverse patch
 Commits reverse patch (new commit)
 git revert HEAD~1
19
History
Index
Workspace
Head
Must be clean!
Before talking about branches…
Demystifying “git reset”, “git checkout”, and “git revert”
 What is revert?
 Does not modify history (good if you pushed already)
 Takes a commit from history
 Creates reverse patch
 Commits reverse patch (new commit)
 git revert HEAD~1
20
History
Index
Workspace
Head
Undo commits after
you‘ve already
pushed them.
Must be clean!
Branching
 After all every change (local or remote) is a fork leading to a new branch
 So make branches a first-class concept
 No logical difference between local and remote branches
 Every merge is a branch merge
21
<Bob>
<Server>
<Alice>
Branching
 Each commit has a parent
 A branch is nothing more than a pointer to a commit
22
Current
Branch
Branching
 Each commit has a parent ( DAG)
 A branch is nothing more than a pointer to a commit
23
Branching
 Local branches may link to “tracking branches”
24
Current
Branch
Branching
 Branches can be linked in ./git/config
(links are also created automatically in certain cases;
or may be linked explicitly using git checkout --track)
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://code.google.com/a/eclipselabs.org/p/moliz/
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "issue_18_alf"]
remote = origin
merge = refs/heads/issue_18_alf
25
Merging Branches
 git checkout master
git merge iss53
26
Merging Branches
 git checkout master
git merge iss53
27
Note that git pull is a git fetch & git merge
Branching Models of Git
 Several different “models”
 All entirely organizational
 The svn-like model:
 Only one branch
 Only one central repo
 git pull (origin master)
 Apply changes
 git commit (master)
 git push (origin master)
 Good for e.g. papers
 The isolated-development model
 Own branch for current dev
 Own branch for releases
 Own branch for each feature
28
Keeping the History of Topic Branches Clean: Rebase
 git checkout experiment
… // apply changes
git commit -a
git checkout master
git merge experiment
29
Keeping the History of Topic Branches Clean: Rebase
 git checkout experiment
… // apply changes
git commit -a
git checkout master
git merge experiment
30
Keeping the History of Topic Branches Clean: Rebase
 git checkout experiment
… // apply changes
git commit -a
git rebase master
31Rebase is rewriting history! Never rebase pushed history!
Keeping the History of Topic Branches Clean: Rebase
 Improving previous commits
… // apply changes
git commit -a
… // apply changes
git commit -a
git rebase -i HEAD~2
# Rebase 710f0f8..a5f4a0d onto 710f0f8
#
# Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
32

More Related Content

What's hot

Pulp - Software Repository Management - a brief introduction
Pulp - Software Repository Management - a brief introductionPulp - Software Repository Management - a brief introduction
Pulp - Software Repository Management - a brief introduction
inovex GmbH
 
Configuration management and orchestration with Salt
Configuration management and orchestration with SaltConfiguration management and orchestration with Salt
Configuration management and orchestration with Salt
Anirban Saha
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
Chapter 03 configuring link aggregation and bridging
Chapter 03   configuring link aggregation and bridgingChapter 03   configuring link aggregation and bridging
Chapter 03 configuring link aggregation and bridging
dimuthur
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Ahmed El-Arabawy
 
Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...
Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...
Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...
Continuent
 
RHive tutorial - Installation
RHive tutorial - InstallationRHive tutorial - Installation
RHive tutorial - Installation
Aiden Seonghak Hong
 
Graphing Nagios services with pnp4nagios
Graphing Nagios services with pnp4nagiosGraphing Nagios services with pnp4nagios
Graphing Nagios services with pnp4nagios
jasonholtzapple
 
Linux comands for Hadoop
Linux comands for HadoopLinux comands for Hadoop
Linux comands for Hadoop
PM Venkatesha Babu
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
Laurent Bernaille
 
OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013databus.pro
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
Automat-IT
 
Supporting Android-based Platform Development in Samsung
Supporting Android-based Platform Development in SamsungSupporting Android-based Platform Development in Samsung
Supporting Android-based Platform Development in Samsung
Perforce
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
Michael Renner
 
Koha installation BALID
Koha installation BALIDKoha installation BALID
Koha installation BALID
Nur Ahammad
 
Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)
Ubuntu Korea Community
 
Les défis des architectures cloud sur OpenStack
Les défis des architectures cloud sur OpenStackLes défis des architectures cloud sur OpenStack
Les défis des architectures cloud sur OpenStack
Osones
 
Deep Dive in Docker Overlay Networks
Deep Dive in Docker Overlay NetworksDeep Dive in Docker Overlay Networks
Deep Dive in Docker Overlay Networks
Laurent Bernaille
 
Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntaxguestcc37e8c
 

What's hot (20)

Pulp - Software Repository Management - a brief introduction
Pulp - Software Repository Management - a brief introductionPulp - Software Repository Management - a brief introduction
Pulp - Software Repository Management - a brief introduction
 
RHive tutorial - HDFS functions
RHive tutorial - HDFS functionsRHive tutorial - HDFS functions
RHive tutorial - HDFS functions
 
Configuration management and orchestration with Salt
Configuration management and orchestration with SaltConfiguration management and orchestration with Salt
Configuration management and orchestration with Salt
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Chapter 03 configuring link aggregation and bridging
Chapter 03   configuring link aggregation and bridgingChapter 03   configuring link aggregation and bridging
Chapter 03 configuring link aggregation and bridging
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
 
Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...
Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...
Tungsten University: MySQL Multi-Master Operations Made Simple With Tungsten ...
 
RHive tutorial - Installation
RHive tutorial - InstallationRHive tutorial - Installation
RHive tutorial - Installation
 
Graphing Nagios services with pnp4nagios
Graphing Nagios services with pnp4nagiosGraphing Nagios services with pnp4nagios
Graphing Nagios services with pnp4nagios
 
Linux comands for Hadoop
Linux comands for HadoopLinux comands for Hadoop
Linux comands for Hadoop
 
Discovering OpenBSD on AWS
Discovering OpenBSD on AWSDiscovering OpenBSD on AWS
Discovering OpenBSD on AWS
 
OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013OpenNebula and SaltStack - OpenNebulaConf 2013
OpenNebula and SaltStack - OpenNebulaConf 2013
 
Git workflows automat-it
Git workflows automat-itGit workflows automat-it
Git workflows automat-it
 
Supporting Android-based Platform Development in Samsung
Supporting Android-based Platform Development in SamsungSupporting Android-based Platform Development in Samsung
Supporting Android-based Platform Development in Samsung
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Koha installation BALID
Koha installation BALIDKoha installation BALID
Koha installation BALID
 
Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)
 
Les défis des architectures cloud sur OpenStack
Les défis des architectures cloud sur OpenStackLes défis des architectures cloud sur OpenStack
Les défis des architectures cloud sur OpenStack
 
Deep Dive in Docker Overlay Networks
Deep Dive in Docker Overlay NetworksDeep Dive in Docker Overlay Networks
Deep Dive in Docker Overlay Networks
 
Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntax
 

Similar to A Brief Introduction to Working with Git

Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
Jason Byrne
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
Jesús Miguel Benito Calzada
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
Tommaso Visconti
 
Git SCM
Git SCMGit SCM
Git basic
Git basicGit basic
Git basic
Akbar Uddin
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
Katie Sylor-Miller
 
Git-ing out of your git messes - Fluent Conf 2017
Git-ing out of  your git messes - Fluent Conf 2017Git-ing out of  your git messes - Fluent Conf 2017
Git-ing out of your git messes - Fluent Conf 2017
Katie Sylor-Miller
 
Atlassian git cheatsheet
Atlassian git cheatsheetAtlassian git cheatsheet
Atlassian git cheatsheet
Abdul Basit
 
Exprimiendo GIT
Exprimiendo GITExprimiendo GIT
Exprimiendo GIT
betabeers
 
Git internals
Git internalsGit internals
Git internals
Haggai Philip Zagury
 
Git cheat-sheet-education
Git cheat-sheet-educationGit cheat-sheet-education
Git cheat-sheet-education
ssuser0bad24
 
Techmoneyguide
TechmoneyguideTechmoneyguide
Techmoneyguide
Rockstartssl
 
Understanding GIT
Understanding GITUnderstanding GIT
Understanding GIT
hybr1s
 
Git cheat-sheet-education
Git cheat-sheet-educationGit cheat-sheet-education
Git cheat-sheet-education
Avitesh Kesharwani
 
test
testtest
test
zwned
 
Effective Git with Eclipse
Effective Git with EclipseEffective Git with Eclipse
Effective Git with Eclipse
Chris Aniszczyk
 
Git undo
Git undoGit undo
Git undo
Avilay Parekh
 
Use Git like a pro - condensed
Use Git like a pro - condensedUse Git like a pro - condensed
Use Git like a pro - condensed
Jesús Miguel Benito Calzada
 
Did you git yet?
Did you git yet?Did you git yet?
Did you git yet?
Michael Fong
 

Similar to A Brief Introduction to Working with Git (20)

Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Git like a pro EDD18 - Full edition
Git like a pro EDD18 - Full editionGit like a pro EDD18 - Full edition
Git like a pro EDD18 - Full edition
 
GIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control SystemGIT: Content-addressable filesystem and Version Control System
GIT: Content-addressable filesystem and Version Control System
 
Git SCM
Git SCMGit SCM
Git SCM
 
Git basic
Git basicGit basic
Git basic
 
Git-ing out of your git messes
Git-ing out of  your git messesGit-ing out of  your git messes
Git-ing out of your git messes
 
Git-ing out of your git messes - Fluent Conf 2017
Git-ing out of  your git messes - Fluent Conf 2017Git-ing out of  your git messes - Fluent Conf 2017
Git-ing out of your git messes - Fluent Conf 2017
 
Git training
Git trainingGit training
Git training
 
Atlassian git cheatsheet
Atlassian git cheatsheetAtlassian git cheatsheet
Atlassian git cheatsheet
 
Exprimiendo GIT
Exprimiendo GITExprimiendo GIT
Exprimiendo GIT
 
Git internals
Git internalsGit internals
Git internals
 
Git cheat-sheet-education
Git cheat-sheet-educationGit cheat-sheet-education
Git cheat-sheet-education
 
Techmoneyguide
TechmoneyguideTechmoneyguide
Techmoneyguide
 
Understanding GIT
Understanding GITUnderstanding GIT
Understanding GIT
 
Git cheat-sheet-education
Git cheat-sheet-educationGit cheat-sheet-education
Git cheat-sheet-education
 
test
testtest
test
 
Effective Git with Eclipse
Effective Git with EclipseEffective Git with Eclipse
Effective Git with Eclipse
 
Git undo
Git undoGit undo
Git undo
 
Use Git like a pro - condensed
Use Git like a pro - condensedUse Git like a pro - condensed
Use Git like a pro - condensed
 
Did you git yet?
Did you git yet?Did you git yet?
Did you git yet?
 

More from Philip Langer

Tailor made model comparison: How to customize EMF Compare for your modeling ...
Tailor made model comparison: How to customize EMF Compare for your modeling ...Tailor made model comparison: How to customize EMF Compare for your modeling ...
Tailor made model comparison: How to customize EMF Compare for your modeling ...
Philip Langer
 
What every Eclipse developer should know about EMF
What every Eclipse developer should know about EMFWhat every Eclipse developer should know about EMF
What every Eclipse developer should know about EMFPhilip Langer
 
Play Framework: The Basics
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The BasicsPhilip Langer
 
You need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF ProfilesYou need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF Profiles
Philip Langer
 
Adaptable Model Versioning using Model Transformation By Demonstration
Adaptable Model Versioning using Model Transformation By DemonstrationAdaptable Model Versioning using Model Transformation By Demonstration
Adaptable Model Versioning using Model Transformation By Demonstration
Philip Langer
 
From UML Profiles to EMF Profiles and Beyond (TOOLS'11)
From UML Profiles to EMF Profiles and Beyond (TOOLS'11)From UML Profiles to EMF Profiles and Beyond (TOOLS'11)
From UML Profiles to EMF Profiles and Beyond (TOOLS'11)
Philip Langer
 
Colex: A Web-based Collaborative Conflict Lexicon
Colex: A Web-based Collaborative Conflict LexiconColex: A Web-based Collaborative Conflict Lexicon
Colex: A Web-based Collaborative Conflict Lexicon
Philip Langer
 

More from Philip Langer (7)

Tailor made model comparison: How to customize EMF Compare for your modeling ...
Tailor made model comparison: How to customize EMF Compare for your modeling ...Tailor made model comparison: How to customize EMF Compare for your modeling ...
Tailor made model comparison: How to customize EMF Compare for your modeling ...
 
What every Eclipse developer should know about EMF
What every Eclipse developer should know about EMFWhat every Eclipse developer should know about EMF
What every Eclipse developer should know about EMF
 
Play Framework: The Basics
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The Basics
 
You need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF ProfilesYou need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF Profiles
 
Adaptable Model Versioning using Model Transformation By Demonstration
Adaptable Model Versioning using Model Transformation By DemonstrationAdaptable Model Versioning using Model Transformation By Demonstration
Adaptable Model Versioning using Model Transformation By Demonstration
 
From UML Profiles to EMF Profiles and Beyond (TOOLS'11)
From UML Profiles to EMF Profiles and Beyond (TOOLS'11)From UML Profiles to EMF Profiles and Beyond (TOOLS'11)
From UML Profiles to EMF Profiles and Beyond (TOOLS'11)
 
Colex: A Web-based Collaborative Conflict Lexicon
Colex: A Web-based Collaborative Conflict LexiconColex: A Web-based Collaborative Conflict Lexicon
Colex: A Web-based Collaborative Conflict Lexicon
 

Recently uploaded

Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 

Recently uploaded (20)

Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 

A Brief Introduction to Working with Git

  • 1. Business Informatics Group Institute of Software Technology and Interactive Systems Vienna University of Technology Favoritenstraße 9-11/188-3, 1040 Vienna, Austria phone: +43 (1) 58801-18804 (secretary), fax: +43 (1) 58801-18896 office@big.tuwien.ac.at, www.big.tuwien.ac.at A Brief Introduction to Working with Git 10.03.2014 VUT, Vienna, Austria Philip Langer
  • 2. History of Versioning Systems Based on http://codicesoftware.blogspot.com/2010/11/version-control- timeline.html local to central … central to distributed … 1972 sccs discourage branching … everything is a branch …
  • 3. Git: A Distributed Versioning System  There is no single repository server  Every peer is a full repository instance  Single-peer versioning possible  Including the complete history  Committing changes is independent of peers  Allows disconnected operation  Collaboration is done by pushing/pulling commits  Comparable to peer-to-peer networks  The role of peers is purely organizational  No technical difference among peers  Single common central server possible  One peer happens to be the central repo  But several other architectures are possible too  Gate-keeper architecture  Teams of teams 3 commit push & pull push & pull push & pull <Bob> <Alice> <Sally> <Server> <Harry> push & pull
  • 4. The Four Layers & Transferring Changes Among Them  Every repository consists of a  Workspace  Index (“staging area”)  Local repository  Remote repositories  …  Transferring changes  git add  workspace to index  git commit  index to local branch  git push  local branch to remote branch  …  Changes are organized in commits  Each commit has a parent  The history is basically a DAG 4
  • 5. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 5 default: HEAD default: --mixed History Index Workspace Head
  • 6. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 6 default: HEAD default: --mixed History Index Workspace Head
  • 7. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 7 default: HEAD default: --mixed History Index Workspace Head
  • 8. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard HEAD~  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 8 default: HEAD default: --mixed History Index Workspace Head
  • 9. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard HEAD~  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 9 default: HEAD default: --mixed History Index Workspace Head !
  • 10. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 10 default: HEAD default: --mixed History Index Workspace Head
  • 11. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 11 default: HEAD default: --mixed History Index Workspace Head Reset index after wrong add
  • 12. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed] HEAD~  History and index  git reset --soft  Only history  … 12 default: HEAD default: --mixed History Index Workspace Head
  • 13. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed] HEAD~  History and index  git reset --soft  Only history  … 13 default: HEAD default: --mixed History Index Workspace Head Undo last commit, however it‘s still there
  • 14. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft  Only history  … 14 default: HEAD default: --mixed History Index Workspace Head Does nothing actualy (HEAD is default)
  • 15. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft HEAD~  Only history  … 15 default: HEAD default: --mixed History Index Workspace Head
  • 16. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is HEAD?  A reference pointing to the last commit (of the current branch)  Thus, it will be the parent of the next commit  Relative commit expressions e.g. with HEAD~2  git reset [--soft | --mixed | --hard] [commit | reference to commit]  Resets HEAD in history, index, and/or workspace to [commit]  git reset --hard  History, index, and workspace  git reset [--mixed]  History and index  git reset --soft HEAD~  Only history  … 16 default: HEAD default: --mixed History Index Workspace Head Undo last commit, leaving index untouched
  • 17. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is checkout?  Get a version from the history  And overwrite workspace  (also for creating and changing branches … later)  git checkout -- <file/s>  Get version of <file/s> from HEAD  Overwrite version in workspace 17 History Index Workspace Head Undo last commit, leaving index untouched
  • 18. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is checkout?  Get a version from the history  And overwrite workspace  (also for creating and changing branches … later)  git checkout -- <file/s>  Get version of <file/s> from HEAD  Overwrite version in workspace 18 History Index Workspace Head Undo local changes to workspace. !
  • 19. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is revert?  Does not modify history (good if you pushed already)  Takes a commit from history  Creates reverse patch  Commits reverse patch (new commit)  git revert HEAD~1 19 History Index Workspace Head Must be clean!
  • 20. Before talking about branches… Demystifying “git reset”, “git checkout”, and “git revert”  What is revert?  Does not modify history (good if you pushed already)  Takes a commit from history  Creates reverse patch  Commits reverse patch (new commit)  git revert HEAD~1 20 History Index Workspace Head Undo commits after you‘ve already pushed them. Must be clean!
  • 21. Branching  After all every change (local or remote) is a fork leading to a new branch  So make branches a first-class concept  No logical difference between local and remote branches  Every merge is a branch merge 21 <Bob> <Server> <Alice>
  • 22. Branching  Each commit has a parent  A branch is nothing more than a pointer to a commit 22 Current Branch
  • 23. Branching  Each commit has a parent ( DAG)  A branch is nothing more than a pointer to a commit 23
  • 24. Branching  Local branches may link to “tracking branches” 24 Current Branch
  • 25. Branching  Branches can be linked in ./git/config (links are also created automatically in certain cases; or may be linked explicitly using git checkout --track) [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = https://code.google.com/a/eclipselabs.org/p/moliz/ [branch "master"] remote = origin merge = refs/heads/master [branch "issue_18_alf"] remote = origin merge = refs/heads/issue_18_alf 25
  • 26. Merging Branches  git checkout master git merge iss53 26
  • 27. Merging Branches  git checkout master git merge iss53 27 Note that git pull is a git fetch & git merge
  • 28. Branching Models of Git  Several different “models”  All entirely organizational  The svn-like model:  Only one branch  Only one central repo  git pull (origin master)  Apply changes  git commit (master)  git push (origin master)  Good for e.g. papers  The isolated-development model  Own branch for current dev  Own branch for releases  Own branch for each feature 28
  • 29. Keeping the History of Topic Branches Clean: Rebase  git checkout experiment … // apply changes git commit -a git checkout master git merge experiment 29
  • 30. Keeping the History of Topic Branches Clean: Rebase  git checkout experiment … // apply changes git commit -a git checkout master git merge experiment 30
  • 31. Keeping the History of Topic Branches Clean: Rebase  git checkout experiment … // apply changes git commit -a git rebase master 31Rebase is rewriting history! Never rebase pushed history!
  • 32. Keeping the History of Topic Branches Clean: Rebase  Improving previous commits … // apply changes git commit -a … // apply changes git commit -a git rebase -i HEAD~2 # Rebase 710f0f8..a5f4a0d onto 710f0f8 # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit 32

Editor's Notes

  1. Prehistory: Versioning was done manually (file was named main_v2.java)RCS and SCCS: text only, no central repository  only one developerCVS: allowed several developers to collaborate using a central repositorySVN: was getting famous because it was easier to use. But it „evangelized“ everyone on the „mainline development model“  no branching should be used.Bitkeeper: Made distributed versioning (P2P) famous and was used for Linux kernel development and several other agile open source projects.Git: Also distributed; it fostered branching because practically everything is a branch: if you check-out and start working, you just created a branch.