Module 2 - Version - Control - GitHub
Module 2 - Version - Control - GitHub
AGENDA
What is Version Control?
Introduction to Git
Git Lifecycle
Merging Branches
WHAT IS VERSION
CONTROL?
Versioning is Automatic
Centralized VCS
Git is the most popular tool among all the DVCS tools.
Git is a version-control system for tracking changes in computer files and coordinating work on those
files among multiple people. It is primarily used for source-code management in software
development, but it can be used to keep track of changes in any set of files.
Working Staging
Commit
Directory Area
Staging Area In either case, the directory is called the working directory
The project can be tracked by git, by using the command git init
Commit
By doing git init, it automatically creates a hidden .git folder
To add files in the staging area, we use the command git add
Commit
Once the files are selected and are ready in the staging area, they can
now be saved in repository
Working Directory
Staging Area
When we commit a repository in git, the commit is identified by a
commit id
Commit The command for initializing this process is git commit –m “message”
Files committed to
git repository
Files committed to
git repository
Project Folder
HEAD
Project Folder
Master Branch
Project Folder
Master Branch
Master Branch
Commi t ID: Commi t ID:
00001 00002
Feature A Branch
Commi t ID:
00002
Master Branch
Commi t ID: Commi t ID:
00001 00002
Feature A Branch
Commi t ID: Commi t ID:
00002 00004
Master Branch
Commi t ID: Commi t ID: Commi t ID:
00001 00002 00004
Feature A Branch
Commi t ID: Commi t ID:
00002 00004
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
Syncing Repositories
Parallel Development
Making Changes
Syncing Repositories
Parallel Development
git log
Once you are back and want to retrieve working, type in git stash pop
Making Changes
Syncing Repositories
Parallel Development
Once the developer has finished his code/feature on his branch, the code will have to
be combined with the master branch. This can be done using two ways:
Git Merge
Git Rebase
Feature A
Git Rebase
Master
Git Rebase
Feature A
Git Merge
Git Rebase
Git Merge
Git Rebase
Git Merge But the master moved forward, while the code was being
developed
Master
Test
Git Rebase
Master
Test
Git Merge
Git Rebase
Test
Git Merge
Test