SVN

GIT

commit

commit

push

3

Offline commits

$git clone https://github.com/First8/grails-trek.git

origin

commit

clone

push

5

On auth

No auth for (local) commits

$git init

commit

push

6

?

origin

$git remote add origin https://github.com/First8/grails-trek.git

On auth

Connecting remote later

origin

push

origin

pull

Pull requests

origin

pull

rev

dev

pull request

11

Peer review part of process

$git init
$git clone <url>
$git add <filename>
$git pull / merge
$git commit -m "msg"

start new local repo

copy & link remote repo

merge code

add file to staging

commit all staged

7

Easy stashing work

stashing

$git stash
$git stash list
$git stash apply
$git stash pop
$git stash drop

Stash (& remove)

List stash

Apply & remove top stash

Apply top stash

Remove top stash

7

Easy stashing work

$git branch -a
$git push -u origin <featurename>

Show branches (local and remote)

Push new branch

 stash@{2}: WIP on master

 stash@{1}: WIP on F1

 stash@{0}: WIP on acc

 stash@{0}: WIP on F2

 stash@{1}: WIP on acc

 stash@{2}: WIP on F1

 stash@{3}: WIP on master

$git stash

branching

$git checkout -b feature_x

8

$git merge feature_x

Easy isolated work

master

F1

F2

$git checkout -b F1
$git checkout -b F2
$git pull
$git rebase master
$git checkout master
$git merge F2
$git add .
$git commit -m "merged F2 into master"
$git push

M += F2

F1 += (M + F2)

(M + F2) += F1

branching in detail

9

Advanced branching / merging

branching

$git checkout -b feature_x
$git checkout feature_x

Create and switch

Switch to branch

$git branch -d feature_x
$git branch

List branches

Delete branch

$git branch -D feature_x

Force delete branch

$git push origin feature_x

Push branch upstream

master

F1

test

acc

prod

F2

master

F1

test

acc

prod

F2

master

F1

test

acc

prod

F2

RC

recap

super easy to start

offline committing

easy update & merge

no authorization nightmare

easy stashing work

easy branching work

advanced branching & merging

peer reviews (pull request)

Github: code ->

- explained

- discussed

- discussion logged

Branching prod:

- isolated features

- no release dependency

- release features io. sprints

- always based on prod

Questions?

Resources:

The simple guide: http://rogerdudler.github.io/git-guide/

The detailed guide: http://git-scm.com/docs/gittutorial

The Atlassian guide: https://www.atlassian.com/git/tutorials/

The cheat sheet: https://training.github.com/kit/downloads/

                                          github-git-cheat-sheet.pdf

If all else fails:

@brampatelski

(Let me Google that for you)

Slides on: http://www.slides.com/brampatelski/

GIT animations

By Bram Patelski

GIT animations

  • 615