Git Starter
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761486/irdeto_logo_rgb-purple.png)
Daniel Lauzon
References
Overview
-
Why one uses git
-
Basics
-
Workflow and Collaboration
-
Hands-on (SourceTree)
What is Version Control
- Track changes over time
- Traceability: Who modified what
- Reproducibility
- Branching and merging
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761890/Attach-icon.png)
Report-2016-06-22-revB-Dan-final-V39
What is Git
- Distributed Version Control
- Performance
- Git is a de-facto standard
Commits
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2825346/A.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2825347/A-B.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2825349/A-B-C.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2825356/Screen_Shot_2016-07-07_at_12.38.44_PM.png)
time
commit: Record all files at a point in time
Hands-on
Setting up a new repository
$ git init my-project
Initialized empty repository in my-project/.git/
Cloning a repository
$ git clone ssh://john@example.com /path/to/my-project.git
$ cd my-project
# Start working on the project
Staging
$ git add A.txt.md $ git status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: A.txt.md
$
Committing
$ git commit -m "My first commit"
[master (root-commit) 605fd93] Adding A file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 A.txt.md
$
Sync'ing
$ git pull origin
$ git push origin master
What is branching
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761606/Screen_Shot_2016-06-17_at_12.17.29_PM.png)
Collaboration
- Benefits of a Standard Workflow
- Feature branch workflow
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761618/Screen_Shot_2016-06-17_at_12.21.05_PM.png)
Feature Branch Workflow
- Each feature gets a branch
- Keep the master branch clean
- Can share a feature branch
- Minimize conflicts
New Feature
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761637/Screen_Shot_2016-06-17_at_12.24.51_PM.png)
git checkout -b my-feature master
Local commits
git status
git add <some-file>
git commit
Share you work
git push -u origin my-feature
- submit a pull request
Code review
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761657/Screen_Shot_2016-06-17_at_12.30.24_PM.png)
- Someone else reviews your changes
Merging your feature
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761666/Screen_Shot_2016-06-17_at_12.31.59_PM.png)
$ git checkout master
$ git pull
$ git pull origin my-feature
# or git merge my-feature
$ git push
Gitflow Workflow
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761675/Screen_Shot_2016-06-17_at_12.34.28_PM.png)
- Same as feature workflow
- Added Conventions
Historical Branches
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761686/Screen_Shot_2016-06-17_at_12.37.56_PM.png)
Feature Branches
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761693/Screen_Shot_2016-06-17_at_12.38.55_PM.png)
Release Branches
![](https://s3.amazonaws.com/media-p.slid.es/uploads/5587/images/2761698/Screen_Shot_2016-06-17_at_12.39.40_PM.png)
Tools
- git command line
- Atlassian SourceTree
- Git Kraken
- ...
Advanced Topics
- Conflicts
- Rebasing vs Merging
- Git internals (checksum)
Hands On!
Thanks!
Questions?
Git Starter
By daneroo
Git Starter
- 849