Top Banner
Make the code work for you with #Git Tomáš Jukin @Inza
60

Make the code work for you with #git

Aug 29, 2014

Download

Technology

Tomáš Jukin

Slides from my presentation on Java BootCamp #5 about Git.

Java BootCamp #5 took place in Hradec Králové at 8. 11. 2012

http://www.java-bootcamp.cz/cs/bootcamp-5
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Make the code work for you with #git

Make the code workfor you with #Git

Tomáš Jukin@Inza

Page 2: Make the code work for you with #git

Tomáš Jukin@Inza

#Objective-C#RubyOnRails

#Git

Page 3: Make the code work for you with #git

A long story short...

Page 4: Make the code work for you with #git

...about a SCM tool

Page 5: Make the code work for you with #git

...about a SCM toolSource Code Management

Page 6: Make the code work for you with #git

SCM?

Centralized

Distributed

Page 7: Make the code work for you with #git

SCM?

Centralized

DistributedGit,

Mercurial,...

CVS,SVN,

...

Page 8: Make the code work for you with #git

Why SCM?

FTP sucks

Mail sucks

Dropbox sucks

USB drive sucks

We NEED to share code!

...and...

Page 9: Make the code work for you with #git

Why SCM?

FTP sucks

Mail sucks

Dropbox sucks

USB drive sucks

We NEED to share code!

...and...

So?

Page 10: Make the code work for you with #git

Why SCM?

Which SCM?

Page 11: Make the code work for you with #git

Which SCM?

CVS is a history

SVN is centralized

Mercurial can’t rebase

...

Today, we NEED to:

...and...

be independantbe productivework offlinehave backupgrow

Page 12: Make the code work for you with #git

Which SCM?

CVS is a history

SVN is centralized

Mercurial can’t rebase

...

Today, we NEED to:

...and...

So?

be independantbe productivework offlinehave backupgrow

Page 13: Make the code work for you with #git
Page 14: Make the code work for you with #git

Distributed SCM

By geeks around Linux Kernel

The most powerful SCM out there

Page 15: Make the code work for you with #git

Tools Ecosystem

Submodules

GitHub

Rebase

Cherry-pick

Stash

Page 17: Make the code work for you with #git

Workflow

Me You

Page 18: Make the code work for you with #git

Workflow

Me You

Page 19: Make the code work for you with #git

Workflow

Me You

Page 20: Make the code work for you with #git

Workflow

Page 21: Make the code work for you with #git

Workflow

Working Copy

Page 22: Make the code work for you with #git

Workflow

Working Copy

Page 23: Make the code work for you with #git

Workflow

Working Copy

Local Repo

Page 24: Make the code work for you with #git

Workflow

Working Copy

Local Repo

Page 25: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Page 26: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

RemoteLocal

Page 27: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

RemoteLocal

Page 28: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

RemoteLocal

Page 29: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

RemoteLocal

Page 30: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add

RemoteLocal

Page 31: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add

RemoteLocal

Page 32: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit

RemoteLocal

Page 33: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit

RemoteLocal

Page 34: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

RemoteLocal

Page 35: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

RemoteLocal

Page 36: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetch

RemoteLocal

Page 37: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetch

RemoteLocal

Page 38: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetchmerge

RemoteLocal

Page 39: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetchmerge

RemoteLocal

Page 40: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetch

pull or rebase

merge

RemoteLocal

Page 41: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetch

pull or rebase

merge

RemoteLocal

Page 42: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

Page 43: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add commit push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

Page 44: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

add

remove

commit push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

Page 45: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

remove

push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

add commit

Page 46: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

remove

push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

add commit

commit -a

Page 47: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

remove

push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

addcommit

commit -aadd -A

Page 48: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

remove

push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

addcommit

commit -aadd -A

?

Page 49: Make the code work for you with #git

Workflow

Working Copy

Index(stage)

Local Repo

Remote Repo

remove

push

fetch

pull or rebase

checkout HEAD

merge

RemoteLocal

addcommit

commit -aadd -A

?status

Page 50: Make the code work for you with #git

Creation (in code)

git clone [email protected]/foo.git foo_dir

cd foo_dir

Local Repo

mkdir foo_dir

cd foo_dir

git init

...or...

Page 51: Make the code work for you with #git

Creation (in code)

git clone [email protected]/foo.git foo_dir

cd foo_dir

Local Repo

mkdir foo_dir

cd foo_dir

git init

...or...

clone url

Page 52: Make the code work for you with #git

Creation (in code)Remote Repo

mkdir foo.git

cd foo.git

git init --bare

Page 53: Make the code work for you with #git

Workflow (in code)

git add -a

git commit -m “Updated foo class”

git push

Page 54: Make the code work for you with #git

Workflow (in code)

git add -a

git commit -m “Updated foo class”

git push

Page 55: Make the code work for you with #git

Workflow (in code)

git pull

git fetch

git merge bar_branch

...or...

Page 56: Make the code work for you with #git

Installation

Windows

msysgit - http://goo.gl/YdToL

MacOS

brew install git

Linux

apt-get install git

Page 57: Make the code work for you with #git

GUIWindows

TortoiseGit - http://goo.gl/9Gfhn

SmartGit - http://goo.gl/P8QqD

MacOS

GitX (L) - http://goo.gl/AMiqc

Linux

Choose yours - http://goo.gl/TebDq

Page 58: Make the code work for you with #git

Next?git flow

“Just one approach to solve branches, releases

and versions”

Page 59: Make the code work for you with #git

Next?Links

Interactive Git Cheatsheet - http://goo.gl/8yMZY

GitHub - http://github.com

semver - http://semver.org

git flow (about) - http://goo.gl/MAF6m

git flow (CLI tool) - http://goo.gl/IbOJr

Page 60: Make the code work for you with #git

@InzaTomáš Jukin

@JuicymoCZ