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

20
Version Control & GIT Floating lesson Yoram Michaeli 21-July-2016 Source-it

Upload: yoram-michaeli

Post on 22-Jan-2018

166 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Source-it Version-contol & GIT - floating-lesson

Version Control & GITFloating lesson

Yoram Michaeli 21-July-2016

Source-it

Page 2: Source-it Version-contol & GIT - floating-lesson

•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

Page 3: Source-it Version-contol & GIT - floating-lesson

Version Control

Source-it

Page 4: Source-it Version-contol & GIT - floating-lesson

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

Page 5: Source-it Version-contol & GIT - floating-lesson

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

Page 6: Source-it Version-contol & GIT - floating-lesson

GIT

Source-it

Page 7: Source-it Version-contol & GIT - floating-lesson

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

Page 8: Source-it Version-contol & GIT - floating-lesson

GIT basics

Source-it

Page 9: Source-it Version-contol & GIT - floating-lesson

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

Page 10: Source-it Version-contol & GIT - floating-lesson

GIT in practice

Source-it

Page 11: Source-it Version-contol & GIT - floating-lesson

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

Page 12: Source-it Version-contol & GIT - floating-lesson

Clone a repository

From command line:

git clone [email protected]:yorammi/source-it.git

Source-it

Page 13: Source-it Version-contol & GIT - floating-lesson

Clone a repository

In Eclipse:

Source-it

Page 14: Source-it Version-contol & GIT - floating-lesson

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

Page 15: Source-it Version-contol & GIT - floating-lesson

Commit a change

From command line:

g i t add –a l l

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

Source-it

Page 16: Source-it Version-contol & GIT - floating-lesson

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

Page 17: Source-it Version-contol & GIT - floating-lesson

Switch between branches

From command line:

g i t checkout master

g i t checkout source- i t

Source-it

Page 18: Source-it Version-contol & GIT - floating-lesson

Merge from branch to branch

From command line:

g i t checkout master

g i t merge source - i t

Source-it

Page 19: Source-it Version-contol & GIT - floating-lesson

Pull request

• Each GIT hosting service may handle pull request differently

• Pull requests are best for code-review and collaboration

Source-it

Page 20: Source-it Version-contol & GIT - floating-lesson

What’s next?Source-it