intro to gitp.3 what is git intro to git started in 2005 created by linus torvalds to aid...

21
Git and Gerrit For Working With and On Qt Qt World Summit 2019 Presented by Kevin Funk

Upload: others

Post on 01-Aug-2020

18 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

GitandGerritForWorkingWithandOnQtQtWorldSummit2019

PresentedbyKevinFunk

Page 2: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.2

IntrotoGit

IntrotoGit

IntrotoGit

IntrotoGerritforQt

Page 3: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.3

WhatisGit

IntrotoGit

Startedin2005

CreatedbyLinusTorvaldstoaiddevelopmentoftheLinuxKernel

Primarilyusedforsourcecodemanagementinsoftwaredevelopment

Availableonallmajorplatforms:Linux,Windows,macOS

FreeandOpenSource

Page 4: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.4

Keyfeatures

IntrotoGit

Instantbranchingandmerging

Smallandfast

Fullydistributed

Dataassurance/integrity

Handleshugeprojectswithease(hint:LinuxKernel)

Uniquefeature:Stagingarea

Page 5: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.5

FromSubversiontoGit

IntrotoGit

Source:git-tower.com

Page 6: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.6

InteractingwithGit

IntrotoGit

Mostpowerful:gitviacommand-lineButalsohasthemost-steeplearningcurve

Graphical(standalone):gitk(cross-platform;'default')GitExtensions(cross-platform;free,GPL)SourceTree(Windows,macOS;free,proprietary)manyothers!(https://git-scm.com/downloads/guis/)

Graphical(integrated):GitpluginsformostIntegratedDevelopmentEnvironments

Page 7: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.7

InteractingwithGit(cont'd)

IntrotoGit

Notethatinthisguidewe'llfocusoninteractionwiththecommand-lineclient

Page 8: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.8

GettingHelp

IntrotoGit

Referencemanual:https://git-scm.com/doc

Orforamorebriefversion:mangit,ORgit--help(equivalenttoabove),ORgitCOMMAND--help

Page 9: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.8

GettingHelp

IntrotoGit

Referencemanual:https://git-scm.com/doc

Orforamorebriefversion:mangit,ORgit--help(equivalenttoabove),ORgitCOMMAND--help

Anotherindispensablesourceforhelp:stackoverflow.com

Page 10: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.9

FirstThingsFirst

IntrotoGit

TellGitwhoyouare:gitconfig--globaluser.name"YourName"gitconfig--globaluser.email"[email protected]"

Globalsettingsfile:~/.gitconfig

Projectsettingsfile:$PROJECTDIR/.git/config

    WindowsusersGitlooksforthe.gitconfigfileinthe%HOME%directory:C:\Users\%USER%formostpeople

Page 11: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.10

USECASE:InitialCheck-out

IntrotoGit

Example(checkingoutfromaremotelocation):gitclonegit://code.qt.io/qt/qt5.git

Example(...andaspecificbranch):gitclonegit://code.qt.io/qt/qt5.git-b5.12

Page 12: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.11

USECASE:Commit

IntrotoGit

Seeyourchanges:gitstatusORgitdiffORgitk

Markthefilesyouwanttocheckin:gitadd<files>

Checkinthemarkedfiles:gitcommitORgitcommit-m"checkinmessage"

Fetchlatestversionfromremoteserver:gitpull

Pushthechangestotheserver:gitpush

Youmaycommitallfilesusing-aoption:gitcommit-a

Demo

Page 13: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.12

IntrotoGerritforQt

IntrotoGerritforQt

IntrotoGit

IntrotoGerritforQt

Page 14: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.13

HowtouseGerritbyexampleofcontributingtoQt

IntrotoGerritforQt

Qt'sdevelopmentoccursintheopeninrepositoriesathttps://codereview.qt-project.org(aGerritcodereviewinstance).

Theyaremirroredread-onlyatcode.qt.io

TheQtprojectprovidesfreehostingtoprojectsrelatedtoQtwhichhavebeenincubatedandacceptedbythecommunity

CloningQt:gitclonegit://code.qt.io/qt/qt5.git

Seehttp://wiki.qt.io/Building_Qt_5_from_Gitforbuildinstructions

Page 15: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.14

ContributingtoQtviaGerrit

IntrotoGerritforQt

PrerequisitesQtAccount(SSO)

https://login.qt.io/registerAccesstoGerrit

https://codereview.qt-project.org/AccesstoJIRA(forclosingbugs,etc.)

https://bugreports.qt.io/SignedContributorAgreement

CanbedoneinGerritMoreinfo:https://www.qt.io/legal-contribution-agreement-qt 

Page 16: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.15

ContributingtoQtviaGerrit(cont'd)

IntrotoGerritforQt

YoumightwanttosubmitapatchbacktoQt'srepositories.

TodothisyouneedtosignupforaGerritaccountathttps://codereview.qt-project.org/.

SetupforusingGerritonyourlocalclone.gitremoteaddgerritGERRIT_URL;...

Commitlocallyasusual.

Pushlocalcommitstogerrit.gitpushgerritHEAD:refs/for/5.9

orgitpushgerritHEAD:refs/for/dev

AremotehookfromGerritwillprintanURL.

OpentheresultingURL(s)andfollowthereviewprocedures.

Page 17: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.16

GerritSetupforQtdevelopment

IntrotoGerritforQt

ConfigureSSH:1 Hostcodereview.qt-project.org2     Port294183     User

Addacommithook:scp-pcodereview.qt-project.org:hooks/commit-msg.git/hooks

Orcopyfromhttp://codereview.qt-project.org/tools/hooks/commit-msg

Addanew"remote"toyourclone:gitremoteaddgerritssh://codereview.qt-project.org/qt/qt5

Seehttp://wiki.qt.io/Setting-up-Gerrit

Page 18: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.17

AddingreviewerstoyourChangeRequest

IntrotoGerritforQt

Findoutwhoworkedonthesourcefile(s)youarechanginggitlog[path]gitblame[path]

Oratleastaddthemodulemaintainerhttps://wiki.qt.io/Maintainers

Page 19: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.18

ChangeRequest:LifeCycle

IntrotoGerritforQt

Page 20: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.19

Resources

Entrypoint:https://www.qt.io/contribute-to-qthttps://wiki.qt.io/Setting_up_Gerrithttps://wiki.qt.io/Gerrit_Introduction

HelpersGitgpushscript:https://wiki.qt.io/Git-gpush-scripts

Page 21: Intro to Gitp.3 What is Git Intro to Git Started in 2005 Created by Linus Torvalds to aid development of the Linux Kernel Primarily used for source code management in software development

p.20

Questions?

[email protected]

KDABisnowofferingGittrainingsandworkshops!