Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
#atlassian
Becoming a Git Master: 
Concepts and Techniques to convert you 
into a master of the DVCS craft 
NICOLA PAOLUCCI • DEVELOP...
Becoming a Git Master: 
Concepts and Techniques to convert you 
into a master of the DVCS craft 
NICOLA PAOLUCCI • DEVELOP...
Marcus Bertrand 
Tim Pettersen 
I'm George. George McFly. 
I'm your density… I mean, 
your destiny 
Stefan Saasen 
Sarah G...
Let’s Become Git Pros!
Here you’ll learn: 
PRO ALIASES & PROMPT 
HIDING STUFF 
CONFLICT RESOLUTION TIPS 
POLISH YOUR CODE 
PREVENT TAMPERING 
PRO...
A pro command prompt
PRO ALIASES & PROMPT 
Everyone has their favorite, but! 
Liquid prompt is awesome 
http://bit.do/liquid-prompt
PRO ALIASES & PROMPT 
Everyone has their favorite, but! 
Liquid prompt is awesome 
http://bit.do/liquid-prompt
Crafting Awesome Aliases
Aliases are stored in 
.gitconfig
In a section prefixed: 
[alias]
PRO ALIASES & PROMPT 
Basic Alias Form 
Very simple: 
ls = log --oneline 
[vagrant@vagrant-ubuntu-trusty-64:/home/vagrant/...
PRO ALIASES & PROMPT 
You can do great things with just this 
For example: amend the last commit with 
everything I have h...
You can’t pass parameters 
to simple aliases :(
Or can you?!
muahahhahahhaha 
hahahahahahahha 
hahahhahahahah!
PRO ALIASES & PROMPT 
For multiple commands or complex 
parameters use a bash function! 
You can escape to a shell with ! ...
PRO ALIASES & PROMPT 
Some useful shortcuts and variables 
More in any bash manual 
$1 - first command line parameter 
$2 ...
Ma, it’s the mini-DSL 
I always wanted!
PRO ALIASES & PROMPT 
What can you do with this? 
Cool cool things, for example add a Bitbucket remote: 
git remote add $1...
PRO ALIASES & PROMPT 
ra = "!f() {  
 
}; f" 
What can you do with this? 
Cool cool things, for example add a Bitbucket re...
PRO ALIASES & PROMPT 
ra = "!f() {  
 
}; f" 
What can you do with this? 
Cool cool things, for example add a Bitbucket re...
PRO ALIASES & PROMPT 
ra = "!f() {  
 
}; f" 
What can you do with this? 
Cool cool things, for example add a Bitbucket re...
PRO ALIASES & PROMPT 
Get all the alias goodness on Bitbucket 
http://bit.do/git-aliases
Powers of invisibility 
© http://www.amigosdosbichos.org/
Powers of invisibility 
© http://www.amigosdosbichos.org/
Tell git which files 
or folders to ignore 
in .gitignore
What if the file is 
already committed?!
muahahhahahhaha 
hahahahahahahha 
hahahhahahahah!
POWERS OF INVISIBILITY 
Hide files from 
Different from .gitignore, it hides committed files 
git update-index --assume-un...
POWERS OF INVISIBILITY 
Hide files from 
Revert it with: 
git update-index --no-assume-unchanged <file> 
remember to add -...
POWERS OF INVISIBILITY 
List assumed unchanged files 
git ls-files -v | grep ^h 
Useful as alias (see alias list from befo...
Conflict Resolution Tips
Conflict Resolution Tips
What is a conflict?
PRO ALIASES & PROMPT 
A word on terminology 
What do ours and theirs mean when solving conflicts? 
Current checked 
out br...
PRO ALIASES & PROMPT 
A word on terminology 
What do ours and theirs mean when solving conflicts? 
Current checked 
out br...
PRO ALIASES & PROMPT 
A word on terminology 
What do ours and theirs mean when solving conflicts? 
Current checked 
out br...
PRO ALIASES & PROMPT 
Basics for easy conflict resolution 
The common commands are: 
$ git checkout --ours/--theirs <file>...
PRO ALIASES & PROMPT 
Basics for easy conflict resolution 
The common commands are: 
$ git checkout --ours/--theirs <file>...
PRO ALIASES & PROMPT 
Aliases for easy conflict resolution 
Add these to [alias] in .gitconfig: 
git checkout --ours $@ &&...
PRO ALIASES & PROMPT 
Aliases for easy conflict resolution 
Add these to [alias] in .gitconfig: 
ours = "!f() {  
git chec...
PRO ALIASES & PROMPT 
rerere resolve! 
Reuse Recorded Resolution will help you when 
dealing with repetitive and similar m...
PRO ALIASES & PROMPT 
Sample output rerere 
$ git add hello.rb 
$ git commit 
Recorded resolution for 'hello.rb'. 
[master...
PRO ALIASES & PROMPT 
Sample output rerere 
$ git add hello.rb 
$ git commit 
Recorded resolution for 'hello.rb'. 
[master...
Cover your tracks (aka polish your code)
Cover your tracks (aka polish your code)
POLISH YOUR CODE 
What is a rebase? 
It’s a way to replay commits, one by one, 
on top of a branch 
MASTER 
FEATURE
POLISH YOUR CODE 
What is a rebase? 
It’s a way to replay commits, one by one, 
on top of a branch 
MASTER 
FEATURE
POLISH YOUR CODE 
What is a rebase? 
It’s a way to replay commits, one by one, 
on top of a branch 
MASTER 
FEATURE
POLISH YOUR CODE 
What is a rebase? 
It’s a way to replay commits, one by one, 
on top of a branch 
MASTER 
FEATURE
POLISH YOUR CODE 
What is a rebase? 
It’s a way to replay commits, one by one, 
on top of a branch 
MASTER 
FEATURE 
Don’t...
POLISH YOUR CODE 
What is a rebase? 
Correct way to use rebase to update a 
feature branch 
MASTER 
FEATURE
POLISH YOUR CODE 
What is a rebase? 
Correct way to use rebase to update a 
feature branch 
MASTER 
FEATURE
POLISH YOUR CODE 
What is an --interactive rebase? 
It’s a way to replay commits, one by one, 
deciding interactively what...
POLISH YOUR CODE 
--autosquash 
Automatically modify the todo list of 
rebase --interactive by annotating commits 
$ git c...
POLISH YOUR CODE 
--autosquash 
You can prepend commit messages with: 
git commit -m “squash! …" 
git commit -m “fixup! …"...
CUSTOMARY 
WARNING! 
rebase rewrites history! 
Treat this power with great care. 
Only rewrite history of local branches o...
Prevent tampering
Always a balancing act 
Security DevSpeed
PREVENT TAMPERING 
Lock down your repo 
Edit .git/config in the [receive] section: 
# no rewriting history 
denyNonFastFor...
Reject force push, 
Luke 
Git project has already an update hook 
‘update-paranoid’ that is designed to 
reject history re...
Reject force push,Luke
Reject force push,Luke
PREVENT TAMPERING 
Impersonating Authors is easy 
with 
$ git commit -m "I'm Luke" 
$ git commit --author "Elvis <elvis@gr...
PREVENT TAMPERING 
Finally you can sign/verify tags 
git tag -s <tag_name> -m “message” 
Sign a tag with your GPG key 
git...
Signing release tags is often 
all you need
PREVENT TAMPERING 
Aside on GPG 
The GNU Privacy Guard 
GnuPG allows to encrypt and sign your data and 
communication, fea...
PREVENT TAMPERING 
Harden up by signing things 
Sample gpg commands to get you started:
PREVENT TAMPERING 
Harden up by signing things 
Sample gpg commands to get you started: 
gpg --gen-key 
Generate your GPG ...
PREVENT TAMPERING 
Harden up by signing things 
Sample gpg commands to get you started: 
gpg --gen-key 
Generate your GPG ...
PREVENT TAMPERING 
Harden up by signing things 
Sample gpg commands to get you started: 
gpg --gen-key 
Generate your GPG ...
PREVENT TAMPERING 
Hide files in raw objects 
The way the Linux kernel hackers do it 
git hash-object -w <file>
PREVENT TAMPERING 
Hide files in raw objects 
The way the Linux kernel hackers do it 
actually writes into the object db 
...
PREVENT TAMPERING 
Hide files in raw objects 
The way the Linux kernel hackers do it 
actually writes into the object db 
...
PREVENT TAMPERING 
Store your signature in 
Simple! Add a tag referencing your public key 
gpg -a --export <keyid> |  
git...
PREVENT TAMPERING 
Store your signature in 
Simple! Add a tag referencing your public key 
gpg -a --export <keyid> |  
git...
PREVENT TAMPERING 
Store your signature in 
Simple! Add a tag referencing your public key 
gpg -a --export <keyid> |  
git...
PREVENT TAMPERING 
Import other public keys 
git cat-file -p tims-key | gpg --import 
Import a GPG key from a tag
PREVENT TAMPERING 
Finally you can sign/verify tags 
git tag -s <tag_name> -m “message” 
Sign a tag with your GPG key 
git...
and Project Dependencies
How do you handle 
project dependencies 
with ?
Splitting up a project 
is painful, for so many 
reasons
Use a build/dependency 
tool instead of
GIT AND PROJECT DEPENDENCIES 
I’ll give you an incomplete list of examples! 
Java 
Nodejs 
Javascript 
Python Pip easy-ins...
GIT AND PROJECT DEPENDENCIES 
I’ll give you an incomplete list of examples! (2) 
C# 
C++ c-make 
Objective C 
PHP 
Go gode...
Another possibility: 
use git submodule
Another possibility: 
use git subtree
Use other build 
and cross-stack 
dependency tools
GIT AND PROJECT DEPENDENCIES 
For example you can check out: 
•Android Repo (http://bit.do/android-repo) 
•Repobuild (chri...
PRO ALIASES & PROMPT 
Review these ideas online 
http://bit.do/git-deps
Thank you! 
NICOLA PAOLUCCI • DEVELOPER ADVOCATE • ATLASSIAN • @DURDN
POWERS OF INVISIBILITY 
Hide files from 
• Level One 
• Level Two 
• Level Two 
• Level Two 
• Level One 
CODE FONT: 
<htm...
POWERS OF INVISIBILITY 
Page title here 
• Level One 
• Level Two 
• Level Two 
• Level Two 
• Level One
Page title here 
• Level One 
• Level Two 
• Level Two 
• Level Two 
• Level One
Page title here 
Page Title Here 
• Level One 
• Level Two 
• Level Two 
• Level Two 
• Level One
Page title here 
• Level One 
• Level Two 
• Level Two 
• Level Two 
• Level One
Caption goes here
Just text by itself, 
for impact.
Just text by itself, 
for impact.
Just text by itself, 
for impact.
Just text by itself, 
for impact.
Just text by itself, 
for impact.
Type Quote Here And Move Both Quotation 
Marks To The Beginning And End Of The 
Quote. Lorem Ipsum Dolor Sit Amet, Conse 
...
Big cool statistic 2,569 Add-Ons in Marketplace
60 
45 
30 
15 
0 
2007 2008 2009 2010 
Region 1 Region 2 Region 3 
Page title here
40% 
30% 
20% 
10% 
2007 2008 2009 2010 
Page title here
Page title here 
COLUMN TITLE COLUMN TITLE COLUMN TITLE 
Content Content 
Content Content 
Content Content 
Content Conten...
Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola Paolucci
Upcoming SlideShare
Loading in …5
×

of

Becoming a Git Master - Nicola Paolucci Slide 1 Becoming a Git Master - Nicola Paolucci Slide 2 Becoming a Git Master - Nicola Paolucci Slide 3 Becoming a Git Master - Nicola Paolucci Slide 4 Becoming a Git Master - Nicola Paolucci Slide 5 Becoming a Git Master - Nicola Paolucci Slide 6 Becoming a Git Master - Nicola Paolucci Slide 7 Becoming a Git Master - Nicola Paolucci Slide 8 Becoming a Git Master - Nicola Paolucci Slide 9 Becoming a Git Master - Nicola Paolucci Slide 10 Becoming a Git Master - Nicola Paolucci Slide 11 Becoming a Git Master - Nicola Paolucci Slide 12 Becoming a Git Master - Nicola Paolucci Slide 13 Becoming a Git Master - Nicola Paolucci Slide 14 Becoming a Git Master - Nicola Paolucci Slide 15 Becoming a Git Master - Nicola Paolucci Slide 16 Becoming a Git Master - Nicola Paolucci Slide 17 Becoming a Git Master - Nicola Paolucci Slide 18 Becoming a Git Master - Nicola Paolucci Slide 19 Becoming a Git Master - Nicola Paolucci Slide 20 Becoming a Git Master - Nicola Paolucci Slide 21 Becoming a Git Master - Nicola Paolucci Slide 22 Becoming a Git Master - Nicola Paolucci Slide 23 Becoming a Git Master - Nicola Paolucci Slide 24 Becoming a Git Master - Nicola Paolucci Slide 25 Becoming a Git Master - Nicola Paolucci Slide 26 Becoming a Git Master - Nicola Paolucci Slide 27 Becoming a Git Master - Nicola Paolucci Slide 28 Becoming a Git Master - Nicola Paolucci Slide 29 Becoming a Git Master - Nicola Paolucci Slide 30 Becoming a Git Master - Nicola Paolucci Slide 31 Becoming a Git Master - Nicola Paolucci Slide 32 Becoming a Git Master - Nicola Paolucci Slide 33 Becoming a Git Master - Nicola Paolucci Slide 34 Becoming a Git Master - Nicola Paolucci Slide 35 Becoming a Git Master - Nicola Paolucci Slide 36 Becoming a Git Master - Nicola Paolucci Slide 37 Becoming a Git Master - Nicola Paolucci Slide 38 Becoming a Git Master - Nicola Paolucci Slide 39 Becoming a Git Master - Nicola Paolucci Slide 40 Becoming a Git Master - Nicola Paolucci Slide 41 Becoming a Git Master - Nicola Paolucci Slide 42 Becoming a Git Master - Nicola Paolucci Slide 43 Becoming a Git Master - Nicola Paolucci Slide 44 Becoming a Git Master - Nicola Paolucci Slide 45 Becoming a Git Master - Nicola Paolucci Slide 46 Becoming a Git Master - Nicola Paolucci Slide 47 Becoming a Git Master - Nicola Paolucci Slide 48 Becoming a Git Master - Nicola Paolucci Slide 49 Becoming a Git Master - Nicola Paolucci Slide 50 Becoming a Git Master - Nicola Paolucci Slide 51 Becoming a Git Master - Nicola Paolucci Slide 52 Becoming a Git Master - Nicola Paolucci Slide 53 Becoming a Git Master - Nicola Paolucci Slide 54 Becoming a Git Master - Nicola Paolucci Slide 55 Becoming a Git Master - Nicola Paolucci Slide 56 Becoming a Git Master - Nicola Paolucci Slide 57 Becoming a Git Master - Nicola Paolucci Slide 58 Becoming a Git Master - Nicola Paolucci Slide 59 Becoming a Git Master - Nicola Paolucci Slide 60 Becoming a Git Master - Nicola Paolucci Slide 61 Becoming a Git Master - Nicola Paolucci Slide 62 Becoming a Git Master - Nicola Paolucci Slide 63 Becoming a Git Master - Nicola Paolucci Slide 64 Becoming a Git Master - Nicola Paolucci Slide 65 Becoming a Git Master - Nicola Paolucci Slide 66 Becoming a Git Master - Nicola Paolucci Slide 67 Becoming a Git Master - Nicola Paolucci Slide 68 Becoming a Git Master - Nicola Paolucci Slide 69 Becoming a Git Master - Nicola Paolucci Slide 70 Becoming a Git Master - Nicola Paolucci Slide 71 Becoming a Git Master - Nicola Paolucci Slide 72 Becoming a Git Master - Nicola Paolucci Slide 73 Becoming a Git Master - Nicola Paolucci Slide 74 Becoming a Git Master - Nicola Paolucci Slide 75 Becoming a Git Master - Nicola Paolucci Slide 76 Becoming a Git Master - Nicola Paolucci Slide 77 Becoming a Git Master - Nicola Paolucci Slide 78 Becoming a Git Master - Nicola Paolucci Slide 79 Becoming a Git Master - Nicola Paolucci Slide 80 Becoming a Git Master - Nicola Paolucci Slide 81 Becoming a Git Master - Nicola Paolucci Slide 82 Becoming a Git Master - Nicola Paolucci Slide 83 Becoming a Git Master - Nicola Paolucci Slide 84 Becoming a Git Master - Nicola Paolucci Slide 85 Becoming a Git Master - Nicola Paolucci Slide 86 Becoming a Git Master - Nicola Paolucci Slide 87 Becoming a Git Master - Nicola Paolucci Slide 88 Becoming a Git Master - Nicola Paolucci Slide 89 Becoming a Git Master - Nicola Paolucci Slide 90 Becoming a Git Master - Nicola Paolucci Slide 91 Becoming a Git Master - Nicola Paolucci Slide 92 Becoming a Git Master - Nicola Paolucci Slide 93 Becoming a Git Master - Nicola Paolucci Slide 94 Becoming a Git Master - Nicola Paolucci Slide 95 Becoming a Git Master - Nicola Paolucci Slide 96 Becoming a Git Master - Nicola Paolucci Slide 97 Becoming a Git Master - Nicola Paolucci Slide 98 Becoming a Git Master - Nicola Paolucci Slide 99 Becoming a Git Master - Nicola Paolucci Slide 100 Becoming a Git Master - Nicola Paolucci Slide 101 Becoming a Git Master - Nicola Paolucci Slide 102 Becoming a Git Master - Nicola Paolucci Slide 103 Becoming a Git Master - Nicola Paolucci Slide 104 Becoming a Git Master - Nicola Paolucci Slide 105 Becoming a Git Master - Nicola Paolucci Slide 106 Becoming a Git Master - Nicola Paolucci Slide 107 Becoming a Git Master - Nicola Paolucci Slide 108 Becoming a Git Master - Nicola Paolucci Slide 109 Becoming a Git Master - Nicola Paolucci Slide 110 Becoming a Git Master - Nicola Paolucci Slide 111 Becoming a Git Master - Nicola Paolucci Slide 112
Upcoming SlideShare
A Business Case for Git - Tim Pettersen
Next
Download to read offline and view in fullscreen.

22 Likes

Share

Download to read offline

Becoming a Git Master - Nicola Paolucci

Download to read offline

Wrapped in a single session, you'll find the concepts and techniques that convert the average Git practitioner into a master of the craft. We'll go from technical topics like "efficient conflict resolution" and "effective code cleanup," to the often-asked "how to handle project dependencies with Git" and "how to manage massive repositories." And much more.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Becoming a Git Master - Nicola Paolucci

  1. 1. #atlassian
  2. 2. Becoming a Git Master: Concepts and Techniques to convert you into a master of the DVCS craft NICOLA PAOLUCCI • DEVELOPER ADVOCATE • ATLASSIAN • @DURDN
  3. 3. Becoming a Git Master: Concepts and Techniques to convert you into a master of the DVCS craft NICOLA PAOLUCCI • DEVELOPER ADVOCATE • ATLASSIAN • @DURDN
  4. 4. Marcus Bertrand Tim Pettersen I'm George. George McFly. I'm your density… I mean, your destiny Stefan Saasen Sarah Goff Dupont
  5. 5. Let’s Become Git Pros!
  6. 6. Here you’ll learn: PRO ALIASES & PROMPT HIDING STUFF CONFLICT RESOLUTION TIPS POLISH YOUR CODE PREVENT TAMPERING PROJECT DEPENDENCIES
  7. 7. A pro command prompt
  8. 8. PRO ALIASES & PROMPT Everyone has their favorite, but! Liquid prompt is awesome http://bit.do/liquid-prompt
  9. 9. PRO ALIASES & PROMPT Everyone has their favorite, but! Liquid prompt is awesome http://bit.do/liquid-prompt
  10. 10. Crafting Awesome Aliases
  11. 11. Aliases are stored in .gitconfig
  12. 12. In a section prefixed: [alias]
  13. 13. PRO ALIASES & PROMPT Basic Alias Form Very simple: ls = log --oneline [vagrant@vagrant-ubuntu-trusty-64:/home/vagrant/buildstep] master ± git ls 90aa814 Merge pull request #85 from marqu3z/master f1eb16b overwrite source.list e6b9d16 change repo before prepare task 8bc10c0 Fix for deprecated repository e34d861 Link to buildpacks.txt instead 4502635 Merge pull request #76 from elia/fix-72-no-buildpack-bundle-install 38be796 Bundle install ain't needed against the buildpack
  14. 14. PRO ALIASES & PROMPT You can do great things with just this For example: amend the last commit with everything I have here uncommitted and new caa = commit -a --amend -C HEAD
  15. 15. You can’t pass parameters to simple aliases :(
  16. 16. Or can you?!
  17. 17. muahahhahahhaha hahahahahahahha hahahhahahahah!
  18. 18. PRO ALIASES & PROMPT For multiple commands or complex parameters use a bash function! You can escape to a shell with ! like this: my_alias = "!f() { <command> }; f”
  19. 19. PRO ALIASES & PROMPT Some useful shortcuts and variables More in any bash manual $1 - first command line parameter $2 - second command line parameter $@ - all command line parameters passed
  20. 20. Ma, it’s the mini-DSL I always wanted!
  21. 21. PRO ALIASES & PROMPT What can you do with this? Cool cool things, for example add a Bitbucket remote: git remote add $1 https://bitbucket.org/$2.git;
  22. 22. PRO ALIASES & PROMPT ra = "!f() { }; f" What can you do with this? Cool cool things, for example add a Bitbucket remote: git remote add $1 https://bitbucket.org/$2.git;
  23. 23. PRO ALIASES & PROMPT ra = "!f() { }; f" What can you do with this? Cool cool things, for example add a Bitbucket remote: git remote add $1 https://bitbucket.org/$2.git; git ra jsmith jsmith/prj
  24. 24. PRO ALIASES & PROMPT ra = "!f() { }; f" What can you do with this? Cool cool things, for example add a Bitbucket remote: git remote add $1 https://bitbucket.org/$2.git; git ra jsmith jsmith/prj
  25. 25. PRO ALIASES & PROMPT Get all the alias goodness on Bitbucket http://bit.do/git-aliases
  26. 26. Powers of invisibility © http://www.amigosdosbichos.org/
  27. 27. Powers of invisibility © http://www.amigosdosbichos.org/
  28. 28. Tell git which files or folders to ignore in .gitignore
  29. 29. What if the file is already committed?!
  30. 30. muahahhahahhaha hahahahahahahha hahahhahahahah!
  31. 31. POWERS OF INVISIBILITY Hide files from Different from .gitignore, it hides committed files git update-index --assume-unchanged <file> very useful with git-svn
  32. 32. POWERS OF INVISIBILITY Hide files from Revert it with: git update-index --no-assume-unchanged <file> remember to add --no
  33. 33. POWERS OF INVISIBILITY List assumed unchanged files git ls-files -v | grep ^h Useful as alias (see alias list from before)
  34. 34. Conflict Resolution Tips
  35. 35. Conflict Resolution Tips
  36. 36. What is a conflict?
  37. 37. PRO ALIASES & PROMPT A word on terminology What do ours and theirs mean when solving conflicts? Current checked out branch !!! --ours
  38. 38. PRO ALIASES & PROMPT A word on terminology What do ours and theirs mean when solving conflicts? Current checked out branch !!! --ours Commit coming in (i.e. via merge) !!! --theirs
  39. 39. PRO ALIASES & PROMPT A word on terminology What do ours and theirs mean when solving conflicts? Current checked out branch !!! --ours Commit coming in (i.e. via merge) !!! --theirs
  40. 40. PRO ALIASES & PROMPT Basics for easy conflict resolution The common commands are: $ git checkout --ours/--theirs <file> Check back out our own/their own version of the file
  41. 41. PRO ALIASES & PROMPT Basics for easy conflict resolution The common commands are: $ git checkout --ours/--theirs <file> Check back out our own/their own version of the file $ git add <file> Add the change to the index will resolve the conflict
  42. 42. PRO ALIASES & PROMPT Aliases for easy conflict resolution Add these to [alias] in .gitconfig: git checkout --ours $@ && git add $@;
  43. 43. PRO ALIASES & PROMPT Aliases for easy conflict resolution Add these to [alias] in .gitconfig: ours = "!f() { git checkout --ours $@ && git add $@; }; f"
  44. 44. PRO ALIASES & PROMPT rerere resolve! Reuse Recorded Resolution will help you when dealing with repetitive and similar merge conflicts. $ git config --global rerere.enabled true Turns it on and forget about it
  45. 45. PRO ALIASES & PROMPT Sample output rerere $ git add hello.rb $ git commit Recorded resolution for 'hello.rb'. [master 68e16e5] Merge branch 'i18n'
  46. 46. PRO ALIASES & PROMPT Sample output rerere $ git add hello.rb $ git commit Recorded resolution for 'hello.rb'. [master 68e16e5] Merge branch 'i18n' Auto-merging hello.rb CONFLICT (content): Merge conflict in hello.rb Resolved 'hello.rb' using previous resolution.
  47. 47. Cover your tracks (aka polish your code)
  48. 48. Cover your tracks (aka polish your code)
  49. 49. POLISH YOUR CODE What is a rebase? It’s a way to replay commits, one by one, on top of a branch MASTER FEATURE
  50. 50. POLISH YOUR CODE What is a rebase? It’s a way to replay commits, one by one, on top of a branch MASTER FEATURE
  51. 51. POLISH YOUR CODE What is a rebase? It’s a way to replay commits, one by one, on top of a branch MASTER FEATURE
  52. 52. POLISH YOUR CODE What is a rebase? It’s a way to replay commits, one by one, on top of a branch MASTER FEATURE
  53. 53. POLISH YOUR CODE What is a rebase? It’s a way to replay commits, one by one, on top of a branch MASTER FEATURE Don’t use!
  54. 54. POLISH YOUR CODE What is a rebase? Correct way to use rebase to update a feature branch MASTER FEATURE
  55. 55. POLISH YOUR CODE What is a rebase? Correct way to use rebase to update a feature branch MASTER FEATURE
  56. 56. POLISH YOUR CODE What is an --interactive rebase? It’s a way to replay commits, one by one, deciding interactively what to do with each PICK! SQUASH REWORD! FIXUP EDIT ! EXEC
  57. 57. POLISH YOUR CODE --autosquash Automatically modify the todo list of rebase --interactive by annotating commits $ git config --global rebase.autosquash true Turns on the feature
  58. 58. POLISH YOUR CODE --autosquash You can prepend commit messages with: git commit -m “squash! …" git commit -m “fixup! …" git commit -m “reword! …" etc… Rebase task list will be then prepopulated
  59. 59. CUSTOMARY WARNING! rebase rewrites history! Treat this power with great care. Only rewrite history of local branches or…
  60. 60. Prevent tampering
  61. 61. Always a balancing act Security DevSpeed
  62. 62. PREVENT TAMPERING Lock down your repo Edit .git/config in the [receive] section: # no rewriting history denyNonFastForwards = true ! # no deleting history denyDeletes = true ! # check object consistency fsckObjects = true
  63. 63. Reject force push, Luke Git project has already an update hook ‘update-paranoid’ that is designed to reject history rewriting updates http://bit.do/update-paranoid
  64. 64. Reject force push,Luke
  65. 65. Reject force push,Luke
  66. 66. PREVENT TAMPERING Impersonating Authors is easy with $ git commit -m "I'm Luke" $ git commit --author "Elvis <elvis@graceland.net>" -m "I'm elvis" commit a9f0967cba236465d6cb68247.. Author: Elvis <elvis@graceland.net> Date: Mon Apr 22 18:06:35 2013 -0500 ! I'm Elvis ! commit d6eb7572cbb4bdd8e2aaa5c90.. Author: Luke <luke@tatooine.com> Date: Mon Apr 22 18:04:54 2013 -0500 ! I'm Luke
  67. 67. PREVENT TAMPERING Finally you can sign/verify tags git tag -s <tag_name> -m “message” Sign a tag with your GPG key git tag -v <tag_name> Verifies that the signature is valid
  68. 68. Signing release tags is often all you need
  69. 69. PREVENT TAMPERING Aside on GPG The GNU Privacy Guard GnuPG allows to encrypt and sign your data and communication, features a versatile key management system.
  70. 70. PREVENT TAMPERING Harden up by signing things Sample gpg commands to get you started:
  71. 71. PREVENT TAMPERING Harden up by signing things Sample gpg commands to get you started: gpg --gen-key Generate your GPG keys
  72. 72. PREVENT TAMPERING Harden up by signing things Sample gpg commands to get you started: gpg --gen-key Generate your GPG keys gpg -k List your keys
  73. 73. PREVENT TAMPERING Harden up by signing things Sample gpg commands to get you started: gpg --gen-key Generate your GPG keys gpg -k List your keys gpg -a --export <keyid> Export your key
  74. 74. PREVENT TAMPERING Hide files in raw objects The way the Linux kernel hackers do it git hash-object -w <file>
  75. 75. PREVENT TAMPERING Hide files in raw objects The way the Linux kernel hackers do it actually writes into the object db git hash-object -w <file>
  76. 76. PREVENT TAMPERING Hide files in raw objects The way the Linux kernel hackers do it actually writes into the object db git hash-object -w <file> Remember to associate a tag to it or it will be garbage collected
  77. 77. PREVENT TAMPERING Store your signature in Simple! Add a tag referencing your public key gpg -a --export <keyid> | git hash-object -w --stdin Store your public key in a raw object
  78. 78. PREVENT TAMPERING Store your signature in Simple! Add a tag referencing your public key gpg -a --export <keyid> | git hash-object -w --stdin Store your public key in a raw object git tag nicks-key 65704f3… Tag the raw object with a label
  79. 79. PREVENT TAMPERING Store your signature in Simple! Add a tag referencing your public key gpg -a --export <keyid> | git hash-object -w --stdin Store your public key in a raw object git tag nicks-key 65704f3… Tag the raw object with a label raw object id
  80. 80. PREVENT TAMPERING Import other public keys git cat-file -p tims-key | gpg --import Import a GPG key from a tag
  81. 81. PREVENT TAMPERING Finally you can sign/verify tags git tag -s <tag_name> -m “message” Sign a tag with your GPG key git tag -v <tag_name> Verifies that the signature is valid
  82. 82. and Project Dependencies
  83. 83. How do you handle project dependencies with ?
  84. 84. Splitting up a project is painful, for so many reasons
  85. 85. Use a build/dependency tool instead of
  86. 86. GIT AND PROJECT DEPENDENCIES I’ll give you an incomplete list of examples! Java Nodejs Javascript Python Pip easy-install Ruby
  87. 87. GIT AND PROJECT DEPENDENCIES I’ll give you an incomplete list of examples! (2) C# C++ c-make Objective C PHP Go godep
  88. 88. Another possibility: use git submodule
  89. 89. Another possibility: use git subtree
  90. 90. Use other build and cross-stack dependency tools
  91. 91. GIT AND PROJECT DEPENDENCIES For example you can check out: •Android Repo (http://bit.do/android-repo) •Repobuild (chrisvana / repobuild) •Chromium depot_tools (http://bit.do/depot-tools) •Facebook Buck (http://facebook.github.io/buck/) •Twitter Pants (http://bit.do/twitter-pants)
  92. 92. PRO ALIASES & PROMPT Review these ideas online http://bit.do/git-deps
  93. 93. Thank you! NICOLA PAOLUCCI • DEVELOPER ADVOCATE • ATLASSIAN • @DURDN
  94. 94. POWERS OF INVISIBILITY Hide files from • Level One • Level Two • Level Two • Level Two • Level One CODE FONT: <html xmlns="http://www.w3.org/1999/xhtml">
  95. 95. POWERS OF INVISIBILITY Page title here • Level One • Level Two • Level Two • Level Two • Level One
  96. 96. Page title here • Level One • Level Two • Level Two • Level Two • Level One
  97. 97. Page title here Page Title Here • Level One • Level Two • Level Two • Level Two • Level One
  98. 98. Page title here • Level One • Level Two • Level Two • Level Two • Level One
  99. 99. Caption goes here
  100. 100. Just text by itself, for impact.
  101. 101. Just text by itself, for impact.
  102. 102. Just text by itself, for impact.
  103. 103. Just text by itself, for impact.
  104. 104. Just text by itself, for impact.
  105. 105. Type Quote Here And Move Both Quotation Marks To The Beginning And End Of The Quote. Lorem Ipsum Dolor Sit Amet, Conse Cetur Ading Elit. DAVID HANDLY, GLOBOCHEM ” “
  106. 106. Big cool statistic 2,569 Add-Ons in Marketplace
  107. 107. 60 45 30 15 0 2007 2008 2009 2010 Region 1 Region 2 Region 3 Page title here
  108. 108. 40% 30% 20% 10% 2007 2008 2009 2010 Page title here
  109. 109. Page title here COLUMN TITLE COLUMN TITLE COLUMN TITLE Content Content Content Content Content Content Content Content Content Content
  • dtrhieu

    Aug. 16, 2017
  • AdrianKurylak

    Feb. 23, 2017
  • Anowarcst

    Nov. 10, 2016
  • DanieleAntonioli

    Oct. 16, 2016
  • SandeepSharma443

    Jun. 14, 2016
  • denisristic1

    Apr. 1, 2016
  • markosa

    Jun. 9, 2015
  • pejvan

    Dec. 16, 2014
  • BobHong

    Nov. 29, 2014
  • evandroamparo

    Nov. 18, 2014
  • vivekkrish

    Nov. 15, 2014
  • od3n

    Nov. 6, 2014
  • lnkusu

    Nov. 4, 2014
  • softroom

    Oct. 30, 2014
  • softroom

    Oct. 30, 2014
  • memow

    Oct. 27, 2014
  • powerirs

    Oct. 26, 2014
  • kofmanalex

    Oct. 25, 2014
  • InnocentSiwela

    Oct. 20, 2014
  • rgaidot

    Oct. 14, 2014

Wrapped in a single session, you'll find the concepts and techniques that convert the average Git practitioner into a master of the craft. We'll go from technical topics like "efficient conflict resolution" and "effective code cleanup," to the often-asked "how to handle project dependencies with Git" and "how to manage massive repositories." And much more.

Views

Total views

5,843

On Slideshare

0

From embeds

0

Number of embeds

2,384

Actions

Downloads

129

Shares

0

Comments

0

Likes

22

×