Software Engineering Essentials
Distributed Version Control
Bernd Bruegge, Stephan Krusche, Andreas Seitz, Jan Knobloch
Chair for Applied Software Engineering — Faculty of Informatics
Learning goals
1) Apply distributed version control in SourceTree
2) Understand different git commands and best practices
2
Distributed version control overview
Local
Local
Developer repository repository Developer
Remote
repository
Web Local
Developer interface repository Developer
3
Share changes: commit
I want to store
file1 and file2
Developer in the repository
commit
Working A commit in git contains all Local
directory changes between two repository
versions
4
Share changes: stage + commit
Select the changed Commit the selected
files you want to changes to the local
commit repository
add commit
Working Staging
Local
directory area repository
5
Share changes: stage + commit + push
Push changes to a
remote repository
(promotion)
add commit push
Working Staging
Local Remote
directory area repository repository
6
Overview of git commands
• git add: add changes to the staging area
• git commit: commit selected changes of the
staging area to your local repository
• git push: upload local commits to a
remote repository
• git pull (fetch & merge): download and merge
remote commits into your working directory
• git clone (fetch & initial checkout): clone a
complete repository into a new working directory
7
Best practices
• Commit related changes
• Commit and push often, at least daily, but do not commit half done work
• Test changes before committing them
• Write meaningful and understandable commit messages
9
Best practices
• Commit related changes
• Commit and push often, at least daily, but do not commit half done work
• Test changes before committing them
• Write meaningful and understandable commit messages
• Do not use version control as a backup
system for binary files
• Keep the local working directory of the
repository up to date (regularly pull and push)
• Do not change published history
10