Getting distributed without losing your HEAD AIS Grid School 2015 Дубна, Россия 3 e Oктября 2015 Benjamin Wolff (CERN / GS-AIS) Logo source: http://git-scm.com/downloads/logos
What is a Version Control System (VCS)?
What is a Version Control System (VCS)?
What is a Version Control System (VCS)? Bob Changes
What is a Version Control System (VCS)? Bob Changes Version History
What is a Version Control System (VCS)? Bob Changes Alice Version History
What is a Version Control System (VCS)? Bob Changes Backup Alice Version History
Agenda
1. What is Git? Agenda
Agenda 1. What is Git? 2. Basic Concepts
Agenda 1. What is Git? 2. Basic Concepts 3. Branching
Agenda 1. What is Git? 2. Basic Concepts 3. Branching 4. Merging
Agenda 1. What is Git? 2. Basic Concepts 3. Branching 4. Merging 5. Remotes
What is Git? Git is a free and open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
What is Git? Git is a free and open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
What is Git? Git is a free and open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
What is Git? Git is a free and open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
What is Git? Git is a free and open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
What is Git? Git is a free and open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Other VCS Solutions
Other VCS Solutions SVN
Other VCS Solutions SVN
What does Git mean? Source: http://commons.wikimedia.org/wiki/file:linus_torvalds_talking.jpeg
What does Git mean? - Linus Torvalds Source: http://commons.wikimedia.org/wiki/file:linus_torvalds_talking.jpeg
What does Git mean? I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git. - Linus Torvalds Source: http://commons.wikimedia.org/wiki/file:linus_torvalds_talking.jpeg
30% 25% Skills in IT Jobs Demand Source: itjobswatch.co.uk, Category: Development Applications Git 20% 15% 10% SVN 5% 0% 2013 2014 2015
30% 25% Skills in IT Jobs Demand Source: itjobswatch.co.uk, Category: Development Applications Git +11,78% 20% 15% 10% 5% SVN -2,20% 0% 2013 2014 2015
Basic Concepts
Central vs. Distributed SVN Source: http://git-scm.com/book/en/getting-started-about-version-control
Central vs. Distributed Git Source: http://git-scm.com/book/en/getting-started-about-version-control
Diffs vs. Snapshots SVN Source: http://git-scm.com/book/en/getting-started-git-basics
Diffs vs. Snapshots Git Source: http://git-scm.com/book/en/getting-started-git-basics
The Staging Area Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Staging Area / Index Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Staging Area / Index Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Staging Area / Index Repository Source: http://git-scm.com/about/staging-area
The Staging Area git add Working Directory Staging Area / Index Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory git add Staging Area / Index git commit Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory git add Staging Area / Index git commit Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Staging Area / Index Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory git checkout Staging Area / Index Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Staging Area / Index Repository Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Staging Area / Index Repository git status Source: http://git-scm.com/about/staging-area
The Staging Area Working Directory Staging Area / Index Repository git status Source: http://git-scm.com/about/staging-area
Commits Source: http://git-scm.com/book/en/git-branching-what-a-branch-is
Commits Source: http://git-scm.com/book/en/git-branching-what-a-branch-is
Commits Source: http://git-scm.com/book/en/git-branching-what-a-branch-is
Commits Source: http://git-scm.com/book/en/git-branching-what-a-branch-is
Commits Source: http://git-scm.com/book/en/git-branching-what-a-branch-is
Basic Branching
Branching with Git
master Branching with Git
Branching with Git master Bob
Branching with Git master C3 C2 Bob C1
Branching with Git master C3 C2 Bob C1 Alice
Branching with Git master C3 C2 Bob C1 Alice
Branching with Git master F2 F1 C3 C2 Bob C1 Alice
master ef9ab
HEAD master ef9ab
HEAD master ef9ab git branch
HEAD master ef9ab git branch
HEAD master ef9ab git checkout
master ef9ab HEAD git checkout
master ef9ab HEAD git commit m Some changes
master ef9ab 78cfa HEAD git commit m Some changes
master ef9ab 78cfa HEAD git commit m Some changes
master ef9ab 78cfa HEAD git commit m Some more changes
master ef9ab 78cfa c83fd HEAD git commit m Some more changes
master ef9ab 78cfa c83fd HEAD git commit m Some more changes
master ef9ab 78cfa c83fd HEAD git checkout master
HEAD master ef9ab 78cfa c83fd git checkout master
HEAD master ef9ab 78cfa c83fd git checkout -b featurey
HEAD featurey master ef9ab 78cfa c83fd git checkout -b featurey
HEAD featurey master ef9ab 78cfa c83fd git commit m Some changes
HEAD featurey master db62a ef9ab 78cfa c83fd git commit m Some changes
HEAD featurey master db62a ef9ab 78cfa c83fd git commit m Some more changes
HEAD featurey master db62a 1ab34 ef9ab 78cfa c83fd git commit m Some more changes
HEAD featurey master db62a 1ab34 ef9ab 78cfa c83fd git commit m Some more changes
Basic Merging
Merging with Git master C3 C2 F2 Bob C1 F1 Alice
Merging with Git master C3 C2 F2 Bob C1 F1 Alice
Merging with Git master M1 C3 C2 F2 Bob C1 F1 Alice
HEAD master db62a 1ab34 ef9ab git checkout master
HEAD master db62a 1ab34 ef9ab git merge
HEAD master db62a 1ab34 ef9ab git merge
HEAD master db62a 1ab34 ef9ab git merge
HEAD master db62a 1ab34 ef9ab git merge
HEAD master db62a 1ab34 ef9ab Fast Forward git merge
HEAD master db62a 1ab34 ef9ab 78cfa c83fd git checkout master
HEAD master db62a 1ab34 ef9ab 78cfa c83fd git merge
HEAD master db62a 1ab34 ef9ab 78cfa c83fd git merge
HEAD master db62a 1ab34 ef9ab 78cfa c83fd git merge
HEAD master db62a 1ab34 a47b1 ef9ab 78cfa c83fd git merge
HEAD master db62a 1ab34 a47b1 ef9ab 78cfa c83fd git merge
HEAD 3-way Merge master ef9ab db62a 78cfa 1ab34 c83fd a47b1 git merge
HEAD 3-way Merge master ef9ab db62a 78cfa 1ab34 c83fd a47b1 git branch d
HEAD 3-way Merge master ef9ab db62a 78cfa 1ab34 c83fd a47b1 git branch d
Resolving Conflicts
Resolving Conflicts
Resolving Conflicts
Resolving Conflicts
Remotes
Remote Interaction Local Repository
Remote Interaction Local Repository git init
Remote Interaction Remote Repository Local Repository
Remote Interaction Remote Repository git clone Local Repository git clone https://mycompany.ru/myproject.git
Remote Interaction Remote Repository origin git clone Local Repository git clone https://mycompany.ru/myproject.git
Remote Interaction Remote Repository Local Repository
Remote Interaction Remote Repository git push Local Repository
Remote Interaction Remote Repository git push git fetch git pull Local Repository
origin ef9ab db62a local ef9ab db62a origin/
origin ef9ab db62a local ef9ab db62a 1ab34 c83fd origin/
origin ef9ab db62a local ef9ab db62a 1ab34 c83fd origin/ git push origin
origin ef9ab db62a 1ab34 c83fd local ef9ab db62a 1ab34 c83fd origin/ git push origin
origin ef9ab db62a 1ab34 c83fd local ef9ab db62a 1ab34 c83fd origin/ git push origin
origin ef9ab db62a local ef9ab db62a origin/
origin ef9ab db62a local ef9ab db62a 1ab34 c83fd origin/
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd origin/
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd origin/ git push origin
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd origin/ git push origin
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd origin/ git push origin
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd origin/ git fetch origin
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd a47b1 fe12a origin/ git fetch origin
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd a47b1 fe12a origin/ git merge origin/
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd 3abba8 a47b1 fe12a origin/ git merge origin/
origin ef9ab db62a a47b1 fe12a local ef9ab db62a 1ab34 c83fd 3abba8 a47b1 fe12a origin/ git push origin
origin ef9ab db62a a47b1 fe12a 3abba8 1ab34 c83fd local ef9ab db62a 1ab34 c83fd 3abba8 a47b1 fe12a origin/ git push origin
Central Repository Workflow Source: http://git-scm.com/about/distributed
Central Repository Workflow Source: http://git-scm.com/about/distributed
Central Repository Workflow Small/medium sized teams Source: http://git-scm.com/about/distributed
Integration Manager Workflow Source: http://git-scm.com/about/distributed
Integration Manager Workflow Source: http://git-scm.com/about/distributed
Integration Manager Workflow GitHub Source: http://git-scm.com/about/distributed
Dictator-Lieutenants Workflow Source: http://git-scm.com/about/distributed
Dictator-Lieutenants Workflow Source: http://git-scm.com/about/distributed
Dictator-Lieutenants Workflow Very large projects, e.g. Linux Kernel Source: http://git-scm.com/about/distributed
Personal Recommendations
Personal Recommendations Forget what you know about version control
Personal Recommendations Forget what you know about version control Try to use the command line at the beginning
Personal Recommendations Forget what you know about version control Try to use the command line at the beginning Read the Git command output carefully
Personal Recommendations Forget what you know about version control Try to use the command line at the beginning Read the Git command output carefully Best way to learn: set up a repo and play with it
Personal Recommendations Forget what you know about version control Try to use the command line at the beginning Read the Git command output carefully Best way to learn: set up a repo and play with it Hang in there, it s worth it!
So Git? Спасибо за ваше внимание!
Вопросы?
Resources http://git-scm.com/ (Excellent docs, tutorials, and resources) http://git-scm.com/book/ (Pro Git, a free Git book) http://gitref.org/ (Quick reference for Git commands) https://www.atlassian.com/en/git/ (Nice visual tutorials & workflows) http://try.github.io/ (Small live tutorial) http://www.youtube.com/ Search for Git