[PDF] [PDF] GIT for Beginners - IRISA

15 mai 2019 · GIT Intro Local GIT Branches Remote GIT Server Bazar Extras GIT for binary files always raise a conflict and require manual merging



Previous PDF Next PDF





[PDF] GIT i - Tutorialspoint

This tutorial explains how to use Git for project version control in a distributed This tutorial will help beginners learn the basic functionality of Git version control



[PDF] GIT for Beginners - IRISA

15 mai 2019 · GIT Intro Local GIT Branches Remote GIT Server Bazar Extras GIT for binary files always raise a conflict and require manual merging



[PDF] Version control: basic Git tutorial

To start version controlling edited existing (new) files (tracking and commiting to local repository): $ git add filename [start tracking new/edited filename]



[PDF] Git tutorialpdf - CERN Indico

The aim here is not to tell you every single Git command in existence or even to The aim is to familiarise you with the principles of version control, some good 



[PDF] Git Tutorial

Git Tutorial Jae Woo Lee and Te git repository for the current directory is stashed in the git directory Let's start our Tere are two ways to display a manual page for a git command For example, for Learning more about git man gittutorial



[PDF] Git Tutorial

learn and to use, but, despite that, Git is the favorite option for developers, which is quite The one we mentioned, the manual process, can be considered as a



[PDF] An introduction to Git and GitHub

This self-paced tutorial will take you through the basic use of Git and GitHub These are systems that 10 Synchronizing your local Git repository with GitHub 9



[PDF] Git Tutorial

learn and to use, but, despite that, Git is the favorite option for developers, which is quite The one we mentioned, the manual process, can be considered as a



[PDF] A Tutorial for GitHub - Ifiuzhch

A Tutorial for Git and GitHub Xiao Li Department of Informatics University of Basic Git Commands GitHub is a web-based Git repository hosting service,



[PDF] Git 101: Git and GitHub for beginners

Install git and create a Github account 2 What is git? 3 Install git ○ Linux ( Debian) ○ Command: sudo apt-get install git ○ Linux (Fedora) Also a good tutorial https://training github com/kit/downloads/github-git-cheat-sheet pdf

[PDF] git tutorial pdf windows

[PDF] github cheat sheet

[PDF] github profile for data science

[PDF] github stock price

[PDF] github tutorial pdf

[PDF] github tutorial pdf download

[PDF] github workflow

[PDF] gitlab cheat sheet

[PDF] give 3 natural sources of air pollution.

[PDF] give a regular expression for l = {anbm: n ≥ 1

[PDF] give an example of a bijective function f : z → (0

[PDF] give an example of a function f on (0

[PDF] give an example of a linear map t : r4 → r4 such that range(t) null(t)

[PDF] give an example of a social issue faced by aboriginal and torres strait islander peoples.

[PDF] give an example of how you could store a document appropriately

Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

GIT for Beginners

Anthony Baire

Universit

´e de Rennes 1 / UMR IRISA

March 9, 2023This tutorial is licensed under aCreative Commons A ttribution-NonCommercial-NoDerivs3.0 F ranceLicense

1/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Objectives

Understand the basics about version control systems

Getting started with GIT

working with a local repository •synchronising with a remote repository •setting up a server 2/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Summary

1.

Ab outV ersionCon trolT ools

2.

Overview of GIT

3.

W orkinglo cally

4.

Branching & mergin g

5.

Interacting with a remote rep ository

6.

A dministratinga server

7.

W orkingwith third-pa rtycontributo rs

8.

Extras

3/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Part 1.

About Version Control Tools

Definition

Use cases

Base concepts

History

4/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

What is a version control system ?

Revision control[...]is the management of changes to documents,

computer programs, large web sites, and other collections of information.Changes are usually identified by a number or letter code, termed the

"revision number"[...].For example, an initial set of files is "revision 1". When the first change is made, the resulting set is "revision 2", and so on.Each revision is associated with a timestamp and the person making the change.Revisions can be compared, restored, and with some types of files, merged. 5/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Use case 1: keeping an history

The life of your software/article is recorded from the beginning• at any moment you can revert to a previous revision1• the history is browseable, you can inspect any revision2• when was it done ? •who wrote it ? •what was changed ? •why ? •in which context ?• all the deleted content remains accessible in the history1 let"s say your not happy with your latest changes2 this is useful for understanding and fixing bugs6/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Use case 2: working with others

VC tools help you to:•

share a collection of files with your team• merge changes done by other users• ensure that nothing is accidentally overwritten•knowwhoyoumustblamewhensomethingisbroken 7/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Use case 3: branching

You may have multiple variants of the same software, materialised asbranches, for example:• a main branch• a maintainance branch(to provide bugfixes in older releases)• a development branch(to make disruptive changes)• a release branch(to freeze code before a new release)VC tools will help you to: handle multiple branches concurrently• merge changes from a branch into another one8/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Use case 4: working with external contributors

VC tools help working with third-party contributors:• it gives them visibility of what is happening in the project• it helps them to submit changes (patches) and it helps you to integrate these patches• forking the development of a software and merging it back into mainline 33
decentralised tools only9/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Use case 5: scaling

Some metrics

4about the Linux kernel (developed with GIT):

about 10000 changesets in each new version (every 2 or 3 months)

1000+ unique contributors4

source: the Linux Foundation10/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Some illustrations

11/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Taxinomy

Architecture:

centralised→everyone works on the same unique repository decentralised→everyone works on his own repositoryConcurrency model: lock before edit(mutual exclusion) merge after edit(may have conflicts)History layout: tree(merges are not recorded) direct acyclic graphAtomicity scope:filevswhole treeGIT 12/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Other technical aspects

Space efficiency: storing the whole history of a project requires

storage space(storing every revision of every file)→most VC tools use delta compression to optimise the space

(except Git which uses object packing instead)Access method: A repository is identified with a URL. VC tools

offer multiple ways of interacting with remote repositories. dedicated protocol (svn:// git://) direct access to a local repository (file://pathor justpath) direct access over SSH (ssh:// git+ssh:// svn+ssh://) over http (http:// https://)13/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Creating new revisions

14/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Creating new revisions

14/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Creating new revisions

14/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Creating new revisions

14/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Creating new revisions

14/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Creating new revisions

14/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

What shall be stored into the repository ?

You should store all files that are not generated by a tool: source files (.c .cpp .java .y .l .tex...) build scripts / project files (Makefile configure.in

Makefile.am CMakefile.txt wscript .sln)

documentation files (.txt README...) resource files (images, audio, ...)You should not store generated files (or you will experience many unneccessary conflicts) .o .a .so .dll .class .jar .exe .dvi .ps .pdf source files / build scripts when generated by a tool (like autoconf, cmake, lex, yacc) 15/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Guidelines for committing

commit often commit independent changes in separate revisions in commit messages, describe the rationale behind of your changes (it is often more important than the change itself) 16/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

History (Centralised Tools)

1stgeneration(single-file, local-only, lock-before-edit)

1972:SCCS

•1982:RCS •1985: PVCS•

2ndgeneration(multiple-files, client-server, merge-before-commit)

1986:CVS

•1992: Rational ClearCase •1994: Visual SourceSafe•

3rdgeneration(+ repository-level atomicity)

1995: Perforce

•2000:Subversion •+ many others17/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

History (Decentralised tools)

18/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Part 2.

Overview of GIT

History

Git"s design & features

User interfaces

19/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

History

before 2005: Linux sources were managed with Bitkeeper (proprietary DVCS tool) 5

April 2005: revocation of the free-use licence

(because of some reverse engineering) No other tools were enough mature to meet Linux"s dev constraints (distributed workflow, integrity, performance). ?Linus Torvald started developing Git

June 2005: first Linux release managed with Git

December 2005: Git 1.0 released5

now open source! (since 2016)20/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Git Design objectives

distributed workflow (decentralised) easy merging (mergedeemed more frequent thancommit) integrity (protection against accidental/malicious corruptions) speed & scalability •easeofuse 21/96
Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Git Design choices

Easily hackable

simple data structures (blobs, trees, commits, tags) •no formal branch history (a branch is just a pointer to the last commit) •low-level commands exposed to the user

Integrity

cryptographic tracking of history (SHA-1 hashes) •tag signatures (GPG)

Merging

pluggable merge strategies •staging area (index)

Performance

no delta encoding 22/96
Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Git Commands

23/96
Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Git GUIs:gitk→browsing the history24/96

Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Git GUIs:git gui→preparing commits25/96

Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

3rd party GUIs

https://git-scm.com/downloads/guis•

Anchorpoint

Aurees

CommandGit

Cong Fork

Fugitive

Git Extensions

Git Klient

GitAhead

GitAtomic

GitDrive

GitFiend•

GitFinder

GitHub

Desktop

GitKraken

GitUI GitUp

GitViewer

GitVine

Gitfox

Gitgui

Gitnuro

Gittyup•

Glint

Guitar

LazyGit

Magit MeGit

NitroGit

Pocket Git

PolyGit

RepoZ

SmartGit

SnailGit

SourceTree•

Sublime Merge

TortoiseGit

Tower

Vershd

Working Copy

giggle git-cola gitg gitonic ungit26/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Part 3.

Working locally

creating a repository adding & committing files the staging area (or index) 27/96
Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Create a new repositorygit initmyrepository

This command creates the directorymyrepository.

the repository is located inmyrepository/.git the (initially empty) working copy is located inmyrepository/ $pwd/tmp $gitinit helloworld Initialized empty Git repository in /tmp/helloworld/.git/ $ls- ahelloworld /. .. .git $lshelloworld /.git/branches config description HEAD hooks info objects refs Note:The/.git/directory contains your whole history,do not delete it 66
unless your history is merged into another repository28/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Commit your first filesgit addfile

git commit [ -m message]

$cdhelloworld $echo?HelloWorld !?>hello $gitadd hello $gitcommit - m" addedfile ?hello?"[master (root-commit) e75df61] added file?hello?1 files changed, 1 insertions(+), 0 deletions(-)

create mode 100644 hello Note:"master" is the name of the default branch created by git init 29/96
Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

The staging area (aka the "index")

Usual version control systems provide two spaces:

therepository (the whole history of your project) theworking tree(orlocal copy)

(the files you are editing and that will be in the next commit)Git introduces an intermediate space : thestaging area

(also calledindex) The index stores the files scheduled for the next commit: git addfiles→copy files into the index git commit→commits the content of the index30/96 Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

The staging area (aka the "index")

31/96
Version ControlGIT IntroLocal GITBranchesRemote GITServerBazarExtras

Update a file

$echo?blahblah blah ?>>hello $gitcommit # On branch master # Changed but not updated: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory)quotesdbs_dbs14.pdfusesText_20