0% found this document useful (0 votes)
22 views25 pages

Gitpresentation 140814102916 Phpapp01 160321215224

Git for developers and testautomation

Uploaded by

6r868pxjgd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views25 pages

Gitpresentation 140814102916 Phpapp01 160321215224

Git for developers and testautomation

Uploaded by

6r868pxjgd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

GIT

By:Naim Latifi
Hope you had a great summer !
Agenda

• VCS (Version control systems)


• What is GIT ?
• GIT branching
• GIT most common commands
• An example scenario
Version control systems (VCS)
• Easily management collaboration on a project by
avoiding frustration of swapping files.

• Ability to have unlimited number of developers working


on the same code base.

• Easily revert back your files if something happened.


VCS (cont’d)
• There are two main categories of version control
systems

• Centralized version control systems

• Distributed version control systems


Centralized VCS
Distributed VCS
What is GIT ?
• GIT is free and open source distributed system
with the emphasis on speed and data integrity.

• No centralized connectivity is needed.

• Powerful and cheap branching with easy to


merge.

• Loosing work in your project is very very hard.


.git directory structure
• .git
• HEAD/ (A pointer to your current branch)
• config/ ( contains all configuration preferences)
• description/(description of your project )
• Index/ (is used as staging area between working directory
and repo)
• logs/ (keeps records to changes that are made in ref)
• objects/ (all data are stored here: commits, trees and tags )
• hooks/ (shell scrips that are invoked after executing a
command)
• refs/ (holds your local branch remote branch and tags)
GIT state operation
. Working Staging area
GIT directory Remote repo
(repo)
directory

Stage files

commit files
Push

Checkout

Fetch

Pull

Untracked unmodified modified staged


GIT branching
• Lightweight movable pointers for different
commits.

• By default the branch name is called “master”.

• You can create as many branches as you need,


merge them or delete (branches are CHEAP on
GIT).

• Merging of branches is easy.


Branch & merge - a case scenario !
• . 8cf9d22 HEAD M Alice’s branches
master
file.x
CONFLICT test
file.x
HEAD fa00e44

eb97f66 HEAD
fa00e49

HEAD fa00e49
79c6e38

a82bc13 HEAD

fa00e49 HEAD
GIT commits ab3342 tree
• .
Tree object
Blob-stores
ab3342c
data
ab3354c SHA-1
checksum
abffs42c

Working Staging Commit - ad4435 Commit - ad5643


directory area
tree – ab3342 tree – 1csd32
author Alice parent – ad4435
Message “test author ……
commit” ……………………

Commit –
637ddx
tree – 321dzr
GIT three way merge
It takes the two latest commits from branch (bb00e39, ab4532) and the most
common ancestor of the two (bb00e39) and creates a new commit (bb00e39)
after successful merge

Master branch

Master Test branch

F44cad bb00e39 bb00e39 bb00e39

ab00e50 ab4532

Test branch
GIT rebasing
The major benefit of rebasing is that you get a much cleaner project history
GIT will "undo" all commits on master that happened Master branch
after the lines began to branch out (common ancestor) and save Test branch
them temporarily
Master

F44cad bb00e39 bb00e398

ab00e50 ab4532
It then will integrate the commits
from our test branch, then the new
commits on branch master are
reapplied on top of integrated Test
commits from branch Test Master
bb00e39

F44cad bb00e39 ab00e50 ab00e51 bb00e398


GIT most common commands
• INIT
• CLONE
• STATUS
• ADD
• CHECKOUT
• COMMIT
• LOG
• REMOTE
• FETCH
• PUSH
• PULL
(cont’d )

creates a local repository

Checkout a repository and create a local copy of it.


(cont’d)

To see the state of your files (modified , added , remote..)

add files to your staging area


(cont’d)

Checkout a tracked file to untracked file. This command is also used for
switching between branches

Commit a stage file


(cont’d)

To get the history of your commits or commits made by someone else

Shows the remote repository name that by default is origin


(cont’d)

Updates remote repository without merging with your local

pushes your commits, branches etc. to remote repository


(cont’d)

Updates remote repository and merge changes with your local repo
An example scenario
Origin

Bmaster

B master BBoxes fetch BBoxes B master


fetch
dsf repo
Remote
Local Local
repo repo
PUSH push
B Boxes

clone

B
master
Local BBoxes
repo
Alice John George
QUESTIONS

You might also like