Git and GitHub for Testers

23
T18 Special Topics 5/5/16 13:30 Git and GitHub for Testers Presented by: Wilson Mar JetBloom Brought to you by: 350 Corporate Way, Suite 400, Orange Park, FL 32073 8882688770 9042780524 [email protected] http://www.stareast.techwell.com/

Transcript of Git and GitHub for Testers

Page 1: Git and GitHub for Testers

T18  Special  Topics  5/5/16  13:30  

Git  and  GitHub  for  Testers  

Presented  by:  

Wilson  Mar  

JetBloom  

Brought  to  you  by:  

350  Corporate  Way,  Suite  400,  Orange  Park,  FL  32073    888-­‐-­‐-­‐268-­‐-­‐-­‐8770  ·∙·∙  904-­‐-­‐-­‐278-­‐-­‐-­‐0524  -­‐  [email protected]  -­‐  http://www.stareast.techwell.com/  

Page 2: Git and GitHub for Testers

Wilson  Mar  JetBloom  

Wilson  Mar  has  been  building  and  bringing  enterprise  applications  to  market  on  major  platforms from  mobile  to  server  clouds as  an  architect,  developer,  performance  tester,  and  manager.  His  website  wilsonmar.com  provides  concise,  in-­‐depth  advice  on  leading  technologies,  especially  on  LoadRunner  and  performance  engineering.  

Page 3: Git and GitHub for Testers

11

Git and GitHub by @WilsonMar at StarEast 2016

Skype: wilsonmar4 http://wilsonmar.github.io

Page 4: Git and GitHub for Testers

Java

tool

s po

pula

rity

http://zeroturnaround.com/rebellabs/java-tools-and-technologies-landscape-for-2014/

Page 5: Git and GitHub for Testers

Intr

oduc

tory

act

iviti

es 1.  Decide on GitHub

2.  Enter the GitHub Ecosystem (Know famous repos) 3.  Code Git-flavored markup on GitHub 4.  Make your own website 5.  Install git command line client 6.  Configure Git environment (SSH) 7.  Setup git GUI client 8.  Analyze and fork a repo on GitHub.com

Page 6: Git and GitHub for Testers

Dai

ly ta

sks

9.  Configure your repo and workflow on GitHub 10. Configure a repo from GitHub 11. Analyze local repository 12.  Fetch remote changes into local repo 13. Make changes in a local repo 14. Remove files 15.  Stash & un-stash tracked files temporarily 16.  Ignore files in repo and globally 17. Commit changes and amend 18. Test locally and back-out

Page 7: Git and GitHub for Testers

Scar

y-is

h ta

sks

19. Resolve a conflicting merge condition 20.  Identify differences 21.  Install and try different diff/merge tools 22.  File push request 23. Clean-up locally 24. Process Github repos automatically

Page 8: Git and GitHub for Testers

Local Git repo.

history

Downloads folder

Git

and

GitH

ub F

ile H

andl

ing

IDE/app

repo-master.zip

folder

file

app default external copies

folder

file manual

copy zip/

copy

Fork Edit

compare (diff)

GitHub.com

repo

@Copyright Wilson Mar 2015. All rights reserved.

your GitHub

.com or hosted repo

upstream

Download

Finder or Windows Explorer

folder

file

Git client

unzip

local machine

Page 9: Git and GitHub for Testers

GitH

ub E

nter

pris

e

https://enterprise.github.com/home

ª  Launched 2011 for private repos ª  $250/user/year (less under SAP license) ª  24/7 support ª  On-premises OVF under VMware ª  ª  LDAP/AD integration ª  Code review features

Page 10: Git and GitHub for Testers

GitL

ab E

nter

pris

e vs

. G

itHub

Ent

erpr

ise

https://about.gitlab.com ª  _ ª  $149/user/year (unlimited private repos) ª  24/7 support ª  On-premises on metal (not VMs), clustered ª  Binary files with GitLab Annex ª  LDAP/AD integration ª  Code review with approvals

Page 11: Git and GitHub for Testers

99

github.com

acct/repo

iOS browser

local

Copyright 2016 by Wilson Mar All rights reserved.

markdown& code

git

acct.github.io

Python

editor

wiki

_site

HTML+ HTML+

browser

/x

grip render

pdf

kindle

browser dillenger.io stackedit.io

CI/CD markdown

ghw API

HTML+

mobi

ePub

AZW

Ruby Jekyll+

gitbook.io, leanpub.com, EC2, etc.

Users:

raw Haroopad, mou.io, etc.

Dropbox

CDN offline

API

HTML+

HTML+

acct/acct.github.io gh-pages

br.

markdown markdown

FTP

Jekyll+ Kramdown

Liquid

Page 12: Git and GitHub for Testers

Gith

ub F

lavo

red

Hea

ding

s &

Li

nks

Mar

kup

# Heading 1

* [Internal](Heading 1.1)

* <a href=“#Heading1.1”>Internal</a>

<a name=“Heading1.1”> ## Heading 1.1</a>

## Heading 1.2 ###

Page 13: Git and GitHub for Testers

Gith

ub F

lavo

red

List

Mar

kup

0. List 1

```

text ```

0. List 2

* Item 1 * Item 2

•  ``` denote coding (HTML)

•  3 spaces before ``` to indent

•  ?

Page 14: Git and GitHub for Testers

Gith

ub F

lavo

red

Tabl

e M

arku

p

| header1 | numbers | | ------- | ------: |

| text 1 | 12.12 |

•  Colon right-aligns

Page 15: Git and GitHub for Testers

Git

clon

e op

tions

(SSH

)

ssh:user@server:project.git http://server/project.git

[email protected]:user/project.git git://server/project.git via port 9418 file://myrepos/project

/myrepos/project

via port 22 via port 80

via hard link only

git config

git clone git clone

git clone git clone

git clone git clone

ssh-keygen –t rsa –C“[email protected]” passphrase

~/.ssh/

origin

git client

via port 22

your github

.com or hosted repo

id_rsa id_rsa.pub

Page 16: Git and GitHub for Testers

Git

wor

kflow

(201

0)

http://nvie.com/posts/a-successful-git-branching-model/

support

Page 17: Git and GitHub for Testers

Runn

ing

alon

g-si

de

GitHub.com develop

local git

ea2

clone c4b

a87

82e

645

c14

3

feature develop

ea2

c4b

a87

82e

645

c14

1

3 fetch

4 diff fetch 5

push 6

5

6 merge

-b branch

2

6

release master (prod) (staging) (remote) (local)

conflict!

resolved

no conflict

ea2

c4b

a87

82e

645

c14 @Copyright

Wilson Mar 2015. All rights reserved.

push

checkout --branch

diff 2 rebased

3

Page 18: Git and GitHub for Testers

Agile

Sto

ry B

ranc

h Pa

tter

n

1.  Pull to update your local master 2.  Checkout a feature branch (JIRA) 3.  Do work in your feature branch, committing early and

often 4.  Rebase frequently to incorporate upstream changes 5.  Interactive rebase (squash) your commits 6.  Merge your changes with master 7.  Push your changes upstream

http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html

Page 19: Git and GitHub for Testers

Chea

t She

et

http://zeroturnaround.com/rebellabs/git-commands-and-best-practices-cheat-sheet/

Page 20: Git and GitHub for Testers

Git

basi

c re

posi

tory

co

mm

ands

git add

git fetch

your github

.com or hosted repo

git pull

staging / index / cache

Working directory

tree

git commit

git push

local git repo.

git merge

git diff

Page 21: Git and GitHub for Testers

Git

com

man

ds a

nd s

tate

s

git add git commit

git push

git branch

git pull

local git repo.

git checkout branch commit

git revert

git clone git init

staging / index / cache

-- amend

git status -s

.gitignore

git log

git fetch

git remote -v

git stash

git stash pop

Working directory

tree

stack

git stash list

git stash apply

$ mkdir

$ rm -rf

git tag

git rebase -i

.git folder

git merge

git reflog

git diff

git mergetool

@Copyright Wilson Mar 2015. All rights reserved.

staged? modified?

deleted?

HEAD

$ touch git clean $ ls -al

Git client

git config

github repo

your github

.com or hosted repo

master

.gitattributes edit

$ echo

Fork Edit

request Pull

git stash drop

origin

upstream

$ cd

git reset

committed?

pushed?

dev

git shortlog git show

git remote add

git difftool

tracked?

Page 22: Git and GitHub for Testers

Pers

onal

wor

kflow

1.  clone 2.   pull to update master (keep up) 3.  checkout (feature) branch, story, defect 4.  edit little pieces (test code first?) 5.   unit test 6.  add to local stage 7.  commit 8.  merge local master 9.  rebase squash (combine commits) 10.  (automated) end-to-end test 11. checkout master 12. merge (push) feature upstream

integrate

separate

modify

Page 23: Git and GitHub for Testers

Life

cycl

e

http://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Removing-Files