git 201

25
Git 201 FreeFriday @ Teipir

Upload: dimitris-tsironis

Post on 07-May-2015

170 views

Category:

Technology


1 download

DESCRIPTION

A secondary presentation for Git given for 0xFreeFridays meetups at Technological Education Institute of Piraeus

TRANSCRIPT

Page 1: Git 201

Git 201FreeFriday @ Teipir

Page 2: Git 201

Real quick...

Page 3: Git 201

Dimitris Tsironis

Front-end Engineer at BugSense,

JavaScript lover || hater,

Open-source & (Coffee)Script addict,

Technology afficcionado

Page 4: Git 201

Previously onFree Fridays...

Page 5: Git 201

How can we work more effectively

in a team?

Page 6: Git 201

Introducing Branching

have multiple versions of the same project

work async & simultaneously

safer & more clean way to do things

very “cheap” branches

Page 7: Git 201

Git

This is where the Git magic is happening!

Page 8: Git 201

creating a branch

$ git branch <new-branch-name> # Creates a new branch

$ git checkout <new-branch-name> # Switch to new branch

$ git branch # Check your local branches

Page 9: Git 201

creating a branch #2

# Creates a new branch and switches to it immediately

$ git checkout -b <new-branch-name>

Page 10: Git 201

Now, you can codeas hard as you can!

Page 11: Git 201

Cool story, bro!But, how can we move our code to our

main branch and continue with our lives?

Page 12: Git 201

Merging

Merge two branches

Keep the chances you want to keep

You’re in control

It’s easier in Git than in other VCS

Page 13: Git 201

merging a local branch

$ git checkout <dest-branch> # Switch to destination

$ git merge <branch-name> # Merge the specified branch

$ git log # Check if everything is fine

Page 14: Git 201

Once you’ve finished...You should do some housekeeping!

Page 15: Git 201

deleting a branch

# Deletes branch, but keeps commits

$ git branch -d <branch-name>

# Force deletes everything, both branch and its commits

$ git branch -D <branch-name> # USE WISELY!!

Page 16: Git 201

The Github wayHow Github handlesbranches & merging

Page 17: Git 201

Branches on Github

Nothing special here

Push your branches on Github

Has some awesome tools for branches

Page 18: Git 201

pushing to Github

# Push branch on Github

$ git push origin <branch-name>

Page 19: Git 201

Pull RequestsA nice, Web 2.0 way to handle merges,

branch and working in a team

Page 20: Git 201

Pull requests

Promoting collaboration

Encouraging open source contributions (fork)

Discussing features & changes on the go

Merge without hassle

and delete the branch

Page 21: Git 201

The real power is in the details!

Let’s see...

Page 22: Git 201

Pull requests: reloaded

Discussion for almost everything

Can be created before coding starts

You have a timeline history of commits

Forum-like functionality

lots of integrations and extra tools

Page 23: Git 201

Extra

tig (apt-get install tig, brew install tig)

Github Help

Git basics presentation

Git documentation

Page 24: Git 201

And, as always, practice, practice,

PRACTICE!

Page 25: Git 201

Thanks!@tsironakos