Git - Some tips to do it better
Upcoming SlideShare
Loading in...5
×
 

Git - Some tips to do it better

on

  • 6,102 views

This short presentation was a 20 minute talk for Barcamp 4 in Ghent (2011). The talk is about how to work better with GIT. Some tips and tricks and must-do's for people who already use git

This short presentation was a 20 minute talk for Barcamp 4 in Ghent (2011). The talk is about how to work better with GIT. Some tips and tricks and must-do's for people who already use git

Statistics

Views

Total Views
6,102
Views on SlideShare
6,057
Embed Views
45

Actions

Likes
23
Downloads
135
Comments
0

12 Embeds 45

http://docs.wpnet.technion.ac.il 13
http://docs.wpnet.technion.ac.il 13
http://202.164.43.88 7
http://paper.li 3
http://localhost 2
url_unknown 1
http://get2volume.com 1
http://s.deeeki.com 1
http://zootool.com 1
http://urbanalliance.com 1
http://www.linkedin.com 1
https://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Git - Some tips to do it better Git - Some tips to do it better Presentation Transcript

  • GITSome tips so we “GIT” it better then before...
  • WHO AM I?@glamorous_be- PHP Developer (@kohanaphp)- jQuery lover- GIT freak- Founder @eidtickets- Owner Glamorous.be- President @jongvldwaregem Jonas De Smet (°86)
  • A little backgroundI learned git because of @kohanaphp his switch to git
  • ... and with the love from @githubIf you don’t have a @github account yet, then this talk isn’t for you...
  • ... and with the love from @githubIf you don’t have a @github account yet, then this talk isn’t for you...
  • 5 MUST-DO’s as git user or you would better not start using git at all...
  • 1. Don’t use a GUI, ever! CLI ftw!• You will never feel the power of GIT• Not (almost) every command is possible through a GUI OK, there are cool GUI’s but becoming an expert is easier the hard way, the CLI-way!
  • 2. Configure git like it should be...•$ git config --global color.ui true•$ git config --global format.pretty oneline•$ git config --global core.autocrlf true (Windows) $ git config --global core.safecrlf true (Windows) $ git config --global core.autocrl input (OSX & linux)•$ git config --global core.excludesfile ~/.gitignore $ printf ".DS_StorenThumbs.dbn._*n" >> ~/.gitignore• enable bash autocompletion (Google it for your OS)
  • 2. Configure git like it should be...•$ git config --global color.ui true•$ git config --global format.pretty oneline•$ git config --global core.autocrlf true (Windows) use a LF $ git config --global core.safecrlf true (Windows) line lways end $ git config --global core.autocrl input (OSX & linux) ing s!•$ git config --global core.excludesfile ~/.gitignore $ printf ".DS_StorenThumbs.dbn._*n" >> ~/.gitignore• enable bash autocompletion (Google it for your OS)
  • 2. Configure git like it should be...•$ git config --global color.ui true•$ git config --global format.pretty oneline•$ git config --global core.autocrlf true (Windows) use a LF $ git config --global core.safecrlf true (Windows) line lways end $ git config --global core.autocrl input (OSX & linux) ing s!•$ git config --global core.excludesfile ~/.gitignore DR Y $ printf ".DS_StorenThumbs.dbn._*n" >> ~/.gitignore• enable bash autocompletion (Google it for your OS)
  • 3. Use a remote repo if possible and probably many more...
  • 4. Use submodules when possible• Better overview of different “parts” in your code• DRY: Re-use repositories in every project trough submodules Good example: Every module in the @kohanaphp framework is a seperate repository, so different contributors and releases possible
  • 5. Branch, branch and tag! Choose your own workflow Source: http://nvie.com/posts/a-successful-git-branching-model/
  • 5 TIPS that will reducethe amount of WTF’sand hopefully making you commit better then before
  • 1. Where’s my commit? Oh no! It’s on a detached HEAD?!•A problem with submodules “currently not on a branch”• Search for your commits SHA-reference (eg. a8e358c) $ git log -p• Merge it with your branch $ git checkout master $ git merge a8e358c
  • 2. Use git merge --no-ffYou will not regret it if you want to revert it! Source: http://nvie.com/posts/a-successful-git-branching-model/
  • 3. Use git add -iBecomes sometime you do different things together...
  • 4. git submodule rm exists, right?
  • 4. git submodule rm exists, right? No!$ vim .gitmodules$ vim .git/config$ git rm --cached path/to/module NO trailing slash!Commit your changes
  • 5. I didn’t change my file but still... git tracks file execution permissions too 2 Possibilities:• Track no permissions $ git config core.fileMode false• Apply the permissions to the files without have it in your repo $ git diff -p | grep -E ^(diff|old mode|new mode) | sed -e s/^old/NEW/;s/^new/old/;s/^NEW/new/ | git apply
  • How to become an expert?
  • ... read some resources• Pro Git book: http://progit.org/book/• Github help: http://gitref.org & http://help.github.com• Git manual: http://www.kernel.org/pub/software/scm/git/docs• Git screencasts: http://gitcasts.com/• Git ready: http://gitready.com/
  • ... and use it, every day!
  • Q&A Follow me at @glamorous_be Fork me on github.com/glamorousSome links on delicious.com/glamorous_be/git