0% found this document useful (0 votes)
6 views9 pages

Mastering Git: Best Practices & Commands

1) The document discusses distributed version control and git commands like add, commit, and push. It explains how developers can commit local changes and share them with others through a remote repository. 2) Key git concepts covered include the staging area, local and remote repositories, and best practices like committing related changes regularly and writing clear commit messages. 3) The overview of git commands explains how to add, commit, and push changes as well as pull remote commits and clone repositories.

Uploaded by

necadeni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views9 pages

Mastering Git: Best Practices & Commands

1) The document discusses distributed version control and git commands like add, commit, and push. It explains how developers can commit local changes and share them with others through a remote repository. 2) Key git concepts covered include the staging area, local and remote repositories, and best practices like committing related changes regularly and writing clear commit messages. 3) The overview of git commands explains how to add, commit, and push changes as well as pull remote commits and clone repositories.

Uploaded by

necadeni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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

You might also like