+ All Categories
Home > Documents > Git presentation, Viktor Pyskunov

Git presentation, Viktor Pyskunov

Date post: 03-Sep-2014
Category:
Upload: viktor-pyskunov
View: 674 times
Download: 0 times
Share this document with a friend
Description:
Introducing Git Principles and How-To Use
Popular Tags:
30
Git Distributed Version Control System by Viktor Pyskunov
Transcript
Page 1: Git presentation, Viktor Pyskunov

Git

Distributed Version Control System

by Viktor Pyskunov

Page 2: Git presentation, Viktor Pyskunov

About

• Created by Linus Torvalds, author of Linux• Very fast• Used in Linux kernel development• Makes working with branches really fun• Better conflict resolution• Working offline• There are no hundreds of .svn directories all over the

code, instead only one .git directory in the root of project• Comfortable to work with commits

Page 3: Git presentation, Viktor Pyskunov

Git design objectives

• Distributed• No central repo• Everyone is on her own island

• Performance• Branching and merge is cheap• Diff the whole kernel tree in less than 1 second• Store the KDE tree in less than 2GB while SVN takes

8GB

Page 4: Git presentation, Viktor Pyskunov

SVN Way

• Commit concurrency• Slow history• Unstaged changes that may be lost due to conflicts

Page 5: Git presentation, Viktor Pyskunov

Git Way

• Every developer has their own repo• Fast history as well as commits• A lot of local commits before pushing• Code staging decreases possibility of data loss

Page 6: Git presentation, Viktor Pyskunov

Git Entities

• Working directory• Index, or staging• Local repository• Remote repository

Page 7: Git presentation, Viktor Pyskunov

Git Commands Dealing with Entities

Page 8: Git presentation, Viktor Pyskunov

Generate ssh Key

Click on Start->Programs->TortoiseGit->PuttyGenGenerateSave private key

Console:ssh-keygen

Page 9: Git presentation, Viktor Pyskunov

Generate ssh Key

Don’t close the windowSave this key somewhereStart->Programs->TortoiseGit->Pageant

Page 10: Git presentation, Viktor Pyskunov

Typical Git Workflow

• Pull from remote repository• Edit files• Add• Commit• Edit files again together with new ones• Add• Commit• Push to remote repository

Page 11: Git presentation, Viktor Pyskunov

Typical Git Workflow Visualized

Page 12: Git presentation, Viktor Pyskunov

Extended Git Workflow

• Pull from remote repository• Create new branch from common branch• Edit files• Add• Commit• Edit files again together with new ones• Add• Commit• Merge your working branch to common branch• Resolve conflicts• Delete working branch• Push to remote repository

Page 13: Git presentation, Viktor Pyskunov

Tortoise Git

Page 14: Git presentation, Viktor Pyskunov

Cloning Repository

Console:git clone <path_to_repository>

Page 15: Git presentation, Viktor Pyskunov

Initial Repository

Page 16: Git presentation, Viktor Pyskunov

History

Console:git log

Page 17: Git presentation, Viktor Pyskunov

Adding new file

Console:git add <file1> <file2> …

Page 18: Git presentation, Viktor Pyskunov

Committing Changes

Console:git commit <file1> <file2> …

Page 19: Git presentation, Viktor Pyskunov

History with New Commit

Page 20: Git presentation, Viktor Pyskunov

New Branch with the Third File

Console:git branch <name_of_branch>

Page 21: Git presentation, Viktor Pyskunov

Adding File

Page 22: Git presentation, Viktor Pyskunov

Committing File in Branch

Page 23: Git presentation, Viktor Pyskunov

Switching to Master

Console:git checkout <name_of_branch>

Page 24: Git presentation, Viktor Pyskunov

Merge from Branch to Master

Console:git merge <name_of_branch>

Page 25: Git presentation, Viktor Pyskunov

Master After Merge

Page 26: Git presentation, Viktor Pyskunov

Branches After Merge

Page 27: Git presentation, Viktor Pyskunov

Push Your Modifications

Checkbox will push all your branchesIf unchecked, only selected branches will be pushed

Console:git push <repository> <branch>

Page 28: Git presentation, Viktor Pyskunov

Fetch with rebase

Using fetch with rebase instead of pull will flatten history of commits to make it sequential

Console:git pull --rebase

Page 29: Git presentation, Viktor Pyskunov

Reverting Commit

Console:git revert <hash_of_commit>

Page 30: Git presentation, Viktor Pyskunov

References

• Book http://progit.org/book/• Tools

http://guides.beanstalkapp.com/version-control/clients.html


Recommended