source-it version-contol & git - floating-lesson

Post on 22-Jan-2018

166 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Version Control & GITFloating lesson

Yoram Michaeli 21-July-2016

Source-it

•Present what is version control and why we use it

•Present what is GIT, its basic concept and what must we know about it in order to use it

•Present basic GIT flows in practice

Presentation GoalsSource-it

Version Control

Source-it

What is version control?

• Vers ion Control (VC) a lso known as source control or rev is ion control

• Vers ion control – management of changes in documents , computer programs or other co l lect ion of informat ion f i les

• Revis ion control i s any k ind of pract ice that t racks and prov ides contro l over changes to source code

• Vers ion Contro l Systems (VCS) – GIT , SVN, C learCase , CVS, Perforce

Source-it

Why do we need version control?

• Col laborat ion

• Work with d i f ferent vers ions of the code

• Contro l the d i f ferent vers ions of the software

• Meet lega l , secur i ty and management requirements

• Track changes of the code and conf igurat ion f i les

Source-it

GIT

Source-it

What is GIT?

• GIT – Free of charge Dist r ibuted Vers ion Contro l System (DVCS)

• GIT has been created in 2005 by L inus Tor valds for the development of the L inux Kernel

• Every GIT directory on every computer i s a fu l lrepos i tory with complete h istory and fu l l vers ion -t rack ing capabi l i t ies

• Every GIT directory i s independent of network access or centra l ser ver

Source-it

GIT basics

Source-it

GIT basic terms

Synchronization actions (network-related actions)

• Clone – making a copy of a remote repository onto a local directory

• Fetch – synchronize the local repository from the remote repository

• Pull – update the local working directory for the current branch from the remote matching branch

• Push – update the remote branch with the latest version of the current branch and/or tags on the local repository

Local work terms (locally without network)

• Add – stage files to be tracked by GIT

• Commit – save local changes into the local repository

• Branch – a repository version pointing to some path in the repository structure

• Checkout – update the local working directory to a certain version of the repository

• Merge – sync. a certain branch of the local repository from another branch or tags or version

Source-it

GIT in practice

Source-it

Common GIT workflows

• Clone a repos i tory

• Synchronize the loca l repos i tory

• Commit a change

• Create a new branch

• Switch between branches

• Merge f rom branch to branch

• Pul l request

Source-it

Clone a repository

From command line:

git clone git@github.com:yorammi/source-it.git

Source-it

Clone a repository

In Eclipse:

Source-it

Synchronize the local repository

From command line:

g i t fetch or ig in

g i t pul l or ig in master

g i t push or ig in master

Source-it

Commit a change

From command line:

g i t add –a l l

g i t commit –m ”source - i t change”

Source-it

Create a new branch

From command line:

g i t branch source - i t

g i t checkout source - i t

W h i c h i s e q u i v a l e n t t o :

g i t checkout –b source - i t

Source-it

Switch between branches

From command line:

g i t checkout master

g i t checkout source- i t

Source-it

Merge from branch to branch

From command line:

g i t checkout master

g i t merge source - i t

Source-it

Pull request

• Each GIT hosting service may handle pull request differently

• Pull requests are best for code-review and collaboration

Source-it

What’s next?Source-it

top related