Getting Git Right

50 %
50 %
Information about Getting Git Right
Technology

Published on March 15, 2014

Author: svenpeters

Source: slideshare.net

Description

When you get Git right, it can help you write cleaner code, roll out new features faster, and make your entire development team more efficient.

his smile is contagious :D Nicola Paolucci Developer Advocate / Git Evangelist Sven Peters Atlassian Ambassador @svenpet svenpet.com @durdn durdn.com checkout his stare :D

Productive TeamsHappy Developers 35 min 35 min

Who knows ?

? doesn’t Who know

Facts 300 Developer

Facts 750 Nerds

Facts working on 9 products

Facts on 4 Continents

SoftwareWe or in just 3 words

SoftwareWe Teams

really small team they know what’s going on! Let’s do it! Great idea! Productivity++

team is growing Let’s do it! Great! Why? Who will do it? Is it done? Have you talked to QA? I have no time for this! Productivity?

Productivity?? we’re not alone Is it profitable?! When is it done?!

is a Devel ping S ftware S cial Challenge

Tools efficient collaboration transparent dev process share knowledge fast feedback

Tools happy developers & productive teams Ship software faster & smarter

Ship software faster & smarter happy developers & productive teams

Our journey to

Great! + Be the change you seek

Technical side Human side

Technical Side: We’ve got you covered Scripts Documentation

S V N atlassian.com/git/migration Technical Side: We’ve got you covered

identifying champions staff training not everyone was happy Human Side: Most important aspect!

At the end we migrated… 200+ 11 21,000 47,228 commits files committers year’s work and that is just for JIRA

The Numbers what is the industry doing?

Git is on the rise 15% 38% from 2011 to 2013 Source: RedMonk Git Survey 2013

Git will continue to grow! 63 % 37 % December 2015 Git CVS + SVN Source: Atlassian Git Survey 2013

Git works for the enterprise! 60% 100+ developers 1,000+ employees Source: Atlassian Git Survey 2013

Git works for the enterprise! 27% 69% use the cloud develop on-premise Source: CollabNet Git Survey 2013

Git means fast releases Git SVN CVS mainly daily - weekly mainly monthly Source: Atlassian Git Survey 2013

Better code with Git Code Reviews are great for the code and the team!

Better code with Git Code Reviews when using GIT +15%more thank you Pull Requests! Source: Atlassian Git Survey 2013

is just a tool!

How do you use ?

Happier Developer with Be a Nicola Paolucci! Developer Advocate / Evangelist Sven Peters! Ambassador March 2014!with! and!

Time machine without paradoxes?

Explore & Understand 1 3 Speed, Speed, Speed Control and Assemble4 Why does make you happy? 2 Freedom & Safety

1 Fast is the new Black Speed, speed, Speed

Staying in the flow makes you happy and your manager happy…

Everything is local Except push & pull

Written in C by Linux kernel and filesystem developers

Read: fast :D

But what if my repo is big? 446k lines of code added 1 3 Recent Linux kernel release (3.13) has 15+ million LOC 1,339 contributors4 2 12,000 non-merge commits source lwn.net

2 Freedom & Safety

Fast Context Switching Freedom to innovate with

Feature Branching

Feature Branching

Feature branches: local git checkout -b new-branch creates a branch and switches to it

Feature branches: published (remote) git push origin new-branch pushes a local branch remotely

git stash is awesome It’s a way to temporarily save your work on a stack

So if your boss comes screaming at your desk

git stash create a patch without a hassle

stash and branch FTW trick close to my heart

Local full clones full local copy of the entire project in a new folder (not common but very easy to do) git clone folder1 folder2

Safety

Losing work is very hard very very

maybe your git server crashed and the hd is corrupted?… no problem

Redundancy, every developer has a clone

Chain of unlosability (I coined a new word!)

Recover a file git checkout file-name

Recover a commit git checkout sha-1 git checkout ref (branch/tag) or

Print file as in branch git show branch:path/to/file can be any ref

find a deleted method git log -S<string> search through all history

When all is lost, use the reflog

What is the reflog? it’s a log of all the places where your HEAD has been garbage collected every 30 days

More on recovery! http://atlss.in/git-armor

Explore & Understand3

Inspect Everything

= history superpowers Hard Questions to git log Ask -S string in all diffs --after,--before when? --author who did what

Who deleted that? git log -1 -- [path] lists where a file was deleted git log --diff-filter=D --summary lists all deleted files

Where is that constant? git grep <regexp> compare the speed between this and regular grep or ack…you’ll be blown away

have I merged this? git branch --no-merged lists branches not merged git branch --merged lists branches already merged

Control and Assemble4

Why merge is awesome ! with

What is a merge? Merge commit master feature merges keep the context of the feature’s commits

git knows the ancestry 1 2 The merge is local powerful merge strategies3 merge is better in git

merge becomes a non-event In most cases

rebase: Fiddle with safety belts on

master feature What is a rebase? It’s a way to replay commits, one by one, on top of a branch

feature master What is a rebase? preserving the order of change-sets

What is an --interactive rebase? It’s a way to replay commits, one by one, deciding interactively what to do with each reword fixup pick squash edit exec

CUSTOMARY WARNING! rebase rewrites history! Treat this power with great care. Only rewrite history of local branches or…

One more thing…

is great for dating

git dating fake!

Explore & Understand 1 3 Speed, Speed, Speed Control and Assemble4 Why does make you happy? 2 Freedom & Safety

Happy Developerwith A

Productive Teamwith A

Improving Code Quality 1 2 Efficient Workflows Protects Code3 Why makes a team great! 4 Natural Fit

Efficient Workflows

upcoming Release? Can we still fix a bug for the Feature Is the code for that complete? for the current version? HotfixHow do we do ReviewedHas everyone the code for this feature ?

Git workflow? What’s the best We don’t know!

+ different teams + different products different cultures = different workflows Git workflow? What’s the best

Design Workflows your own

Issues Code

Issues Code #30 #45#45 #30

Can’t be released right now Unfinished features in your trunk / master branch

Branch per issue First: feature/IRKD-30 stable master branch isolated feature work master

feature/IRKD-30 Branch per issue First: project issue branch type

Typos happne! Tool switching sucks

Atlassian Marketplace1 Workflow SAAS Workflow

Simplest Workflow release from here feature/IRKD-30 feature/IRKD-45 master

Simplest Workflow release from here feature/IRKD-30 feature/IRKD-45 develop master integrate here

Atlassian Stash2 Workflow Installable software

Multiple Product Versions feature/IRKD-30 master v 1.2 v 1.1

Multiple Product Versions master v 1.2 v 1.1 bugfix/IRKD-41

Multiple Product Versions master v 1.2 v 1.1 bugfix/IRKD-41

Multiple Product Versions master v 1.2 v 1.1 bugfix/IRKD-45

Multiple Product Versions master v 1.2 v 1.1 bugfix/IRKD-45

Multiple Product Versions master v 1.2 v 1.1 bugfix/IRKD-45 boring work

Automatic merges https://bitbucket.org/durdn/automatic-merge-hook with a Git hook

Automatic merges with Stash

Design your workflow Nearly everything is possible with

Good for Code stable branches less error prone Team & better understanding transparency easier onboarding

Improving Code Quality

Have you ever been sitting in a long review session?

Felt uncomfortable when your code was discussed?

Code Reviews Some good reasons to skip meetings

Code Reviews Better Quality Learn Feel Better

Code Reviews Make part of your daily work asynchronously less painful

Pull Requests Make part of your daily work 

Part of your daily work

Part of your daily work do it before merge

Discuss Be respectful!

Be respectful!

Be respectful!

Side by side diff compare like a pro

invited reviewers

invited reviewers minimum X approvals Go merge! fast development

Minimum of approvals

Who would be the best to review my code?

Auto Suggest Reviewers Free Add On For

suggestions why? Auto Suggest Reviewers

Auto Suggest Reviewers committed code to this Pull Request Suggestions: contributed files that were modified

Code Reviews Make part of your daily work asynchronously less painful

Protects Code without slowing you down

Control access to your repositories

Permissions for Repositories        Users & Groups Repositories  

Permissions for Repositories        Projects   Users & Groups

Permissions for Repositories        Projects   Users & Groups

Permissions for Repositories        Projects   Users & Groups

Pure Permissions for Repositories Repository Manger - visual interface - role based - file system access - SSH - HTTPS

Less time configuring more time to code and waiting Repository Manger

People can change code - You control the input

Forks The way to allow changes & protect your code

 Server side clone of the repository 

Server side clone of the repository  

Pull request to contribute changes   

Would Batman allow Robin to fight Joker on his own? Team

Branch Permissions master <deploy on green build to production> branch everyone can read & branch with feature/IRKD-30 master

master <deploy on green build to production> branch with feature/IRKD-30 master only allowed by trusted devs Branch Permissions

withBranch Permissions

Know your priorities Security DevSpeed

Natural Fit to your existing flow

There is so much going on in our projects! Pull Requests Sprints Builds Issues Branches

Every line of code starts with Real Life Problema

Every line of code starts with Issuean

Every line of code should be connected to Issuean

Issue Code Git What most issue tracker do commit -m "fixes #6"

But what about the Feature Branch?

Issue CodeGit What some issue trackers do commit -m "fixes #6"

Issue CodeGit What some issue trackers do branch “feature/IRKD-30“

Less time tool switching more time to code

Less time answering questions more time to code

Visualize your development IN PROGRESS Status People Code Issue good old days

Visualize your development  Issue Sprint Branch Pull Request  Build in 2014 style

Visualize your development 

Visualize your development

& CI

experiment on your feature branch Running builds on feature branches

experiment on your feature branch Running builds on feature branches keep your master branch green

all active branches are under test Running builds on feature branches

Running builds on feature branches Clone master’s CI config

You’ll forget to set up the build in your feature branch! try to remember

Auto detect branches

Running builds on feature branches Jenkins plugin or Git hook bitbucket.org/tpettersen/git-ci-hooks

Running builds on feature branches Build into

Less time configuring more time to code

x developer times x push to remote = lots of builds (waiting)

Running builds on feature branches automatically manuallyfeature/IRKD-30 master v 1.2

See what’s going on Builds Commits New branches Pull Requests with

See what’s going on Deployment info with

See what’s going on Warnings with

More time to code Better collaboration Dev productivity The future Economics Why Git? Deliver software faster Less bugs Happy customers

Why Git? Ship software faster & smarter

Q & A Free 30 day trail Free for 5 users Just free!

Add a comment

Related presentations

Related pages

Getting Git Right | Atlassian Git Tutorial

Learn the basics of Git through this comprehensive set of Git tutorials, which covers branching, pull requests, merging and more.
Read more

Getting Git Right: Atlassian Event in Berlin - codecentric

Getting Git Right – mit diesem Slogan tourt das Atlassian-Team derzeit durch die USA und Europa. Atlassian-Experten berichten bei insgesamt zehn Terminen ...
Read more

Welcome - Getting Git Right - Berlin

Venue Location: KUNZTSCHULE SCHÜTZENSTRASSE 6 D-10117 BERLIN Agenda: Join Atlassian and learn how we use Git efficiently for our software development.
Read more

Welcome - Getting Git Right - Helsinki

Venue Location: Helsinki Paasitorni Paasivuorenkatu 5, 00530 Helsinki, Finland Room: Congress Hall . Agenda: Join Atlassian and learn how we use Git ...
Read more

Getting git right - asquera.de

On the 27th November, after the last Mrgn of the year, I spent the afternoon at the Getting Git Right event organised by Atlassian (makers of JIRA ...
Read more

Getting Git Right in Helsinki – Rule of Tech

Interesting part of the event was talk about what is efficient and the best Git workflow? The answer is “we don’t know”. It depends as there are ...
Read more

Welcome - Getting Git Right - Vancouver

Venue Location: Vancouver Fan Club 1050 Granville St. Vancouver, BC V6Z 1L5, Canada . Agenda: Join Atlassian and learn how we use Git efficiently for our ...
Read more

Welcome - Getting Git Right - Copenhagen

Venue Location: Copenhagen Marriott Hotel Kalvebod Brygge 5 Copenhagen 1560 Denmark Room: Vesterhavet II. Agenda: Join Atlassian and learn how we use Git ...
Read more

Welcome - Getting Git Right - San Diego

Venue Location: The Shout House 655 4th Avenue San Diego, CA 92101. Agenda: Join Atlassian and learn how we use Git efficiently for our software development.
Read more