8.08M
Категория: ПрограммированиеПрограммирование

Version control

1.

Version control
Aleksei Popov, Artyom Andrianov
fintech.tinkoff.ru

2.

Motivation
Storage of source code
Historical versions
Collaboration

3.

Copy-paste VCS
Version 1.0
Version 1.1
Version 2.0

4.

Local VCS
Checkout
Versions
Patches

5.

Centralized VCS

6.

Distributed VCS

7.

01
04
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 basics
01
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.

Initialization

10.

The three stages
Git has three main states that your files
can reside in:
• Modified
• Staged
• Committed

11.

Deltas

12.

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 Files

14.

Lifecycle of Files
$ git status

15.

Lifecycle of Files
Save to stage:
$ git add <file>

16.

Lifecycle of Files
Check unstated files:
$ git status

17.

Lifecycle of Files
Commit changes:
$ git commit -m

18.

Git Branching
Commit changes:
$ git commit -m

19.

Unstaged changes

20.

Unstaged changes

21.

Staged changes

22.

Staged changes

23.

All changes

24.

Location- vs. Content-Addressable
Storage

25.

Blobs and Trees

26.

Git branching
Nearly 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.

Commits

28.

Parents
If you make some changes and
commit again, the next commit
stores a pointer to the commit
that came immediately before
it.

29.

Master branch
Branch 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 reference
HEAD is a special pointer directing on a current
branch.

32.

Checkout to Branch
$ git checkout
testing

33.

Checkout to Branch
The 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 Basics
Three 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

38.

Merge Conflicts

39.

Resolving Conflicts

40.

Resolving Conflicts

41.

Cherry Picking

42.

Cherry Picking
English     Русский Правила