Similar presentations:
Version control
1.
Version controlAleksei Popov, Artyom Andrianov
fintech.tinkoff.ru
2.
MotivationStorage of source code
Historical versions
Collaboration
3.
Copy-paste VCSVersion 1.0
Version 1.1
Version 2.0
4.
Local VCSCheckout
Versions
Patches
5.
Centralized VCS6.
Distributed VCS7.
0104
Linux development community
02
Speed
Development started when
BitKeeper VCS stopped to be
free
Git is insanely fast comparing to
any centralized VCS
Support for non-linear development
Fully distributed
Allows to develop in
thousands of parallel
branches
05
Every user have a local copy of
repository
03
Simple design
Allows git to be reliable and
easy to modify
8.
Git basics01
03
Has integrity
02
Generally only adds data
Git thinks of its data more like a series of
snapshots of a miniature filesystem.
With Git, every time you commit, or save
the state of your project, Git basically
takes a picture of what all your files look
like at that moment and stores a
reference to that snapshot.
When you do actions in Git, nearly
all of them only add data to the Git
database. It is hard to get the
system to do anything that is not
undoable or to make it erase data
in any way.
Snapshots, not differences
Nearly every operation is local
Everything in Git is checksummed
before it is stored and is then
referred to by that checksum. This
means it’s impossible to change
the contents of any file or directory
without Git knowing about it.
04
Most operations in Git need only
local files and resources to operate
— generally no information is
needed from another computer on
your network.
03
Nearly every operation is local
Клиенты
сами подсказывают,
что у них болит, но не всегда
эта информация доходит до
нас
9.
Initialization10.
The three stagesGit has three main states that your files
can reside in:
• Modified
• Staged
• Committed
11.
Deltas12.
Snapshots• Git stores a link to unchanged files
• Git thinks about its data more like a stream of
snapshots
• It makes Git reconsider almost every aspect
of version control
• This makes Git more like a mini filesystem
13.
Lifecycle of Files14.
Lifecycle of Files$ git status
15.
Lifecycle of FilesSave to stage:
$ git add <file>
16.
Lifecycle of FilesCheck unstated files:
$ git status
17.
Lifecycle of FilesCommit changes:
$ git commit -m
18.
Git BranchingCommit changes:
$ git commit -m
19.
Unstaged changes20.
Unstaged changes21.
Staged changes22.
Staged changes23.
All changes24.
Location- vs. Content-AddressableStorage
25.
Blobs and Trees26.
Git branchingNearly every VCS has some form of branching
support. Branching means you diverge from the
main line of development and continue to do work
without messing with that main line.
Git filesystems consists of thee types of data nodes:
• Blobs
• Trees
• Commits
27.
Commits28.
ParentsIf you make some changes and
commit again, the next commit
stores a pointer to the commit
that came immediately before
it.
29.
Master branchBranch is simply a lightweight movable pointer
to one if these commits
Main branch in Git repository is called
«master(main)»
30.
Creating a new branch$ git branch testing
Creates a new pointer to the same commit
you’re currently on
Git branch only created a new branch, it didn’t
switch to that branch!
31.
Head referenceHEAD is a special pointer directing on a current
branch.
32.
Checkout to Branch$ git checkout
testing
33.
Checkout to BranchThe HEAD branch moves forward when a
commit is made
34.
Checkout to Branch$ git checkout master
HEAD moves when you checkout
35.
Diverged Branches$ vim test.rb
$ git commit -a -m 'made other changes'
36.
Merge BasicsThree snapshots used in a typical merge
Instead of just moving the branch pointer forward, Git
creates a new snapshot that results from this three-way
merge and automatically creates a new commit that points
to it. This is referred to as a merge commit, and is special in
that it has more than one parent.
37.
Merge$ git merge iss53