SlideShare a Scribd company logo
1 of 27
GIT
Some 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 background
I learned git because of @kohanaphp his switch to git
... and with the love from @github
If you don’t have a @github account yet, then this talk isn’t for you...
... and with the love from @github
If 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 reduce
the amount of WTF’s
and 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-ff
You will not regret it if you want to revert it!




                Source: http://nvie.com/posts/a-successful-git-branching-model/
3. Use git add -i
Becomes 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/glamorous
Some links on delicious.com/glamorous_be/git

More Related Content

What's hot

maksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your cimaksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your ciDariia Seimova
 
SCM Gitlab Advanced
SCM Gitlab AdvancedSCM Gitlab Advanced
SCM Gitlab AdvancedAman Patial
 
Ktor 101 (以 Ktor 實作 Website 範例)
Ktor 101 (以 Ktor 實作 Website 範例)Ktor 101 (以 Ktor 實作 Website 範例)
Ktor 101 (以 Ktor 實作 Website 範例)Shengyou Fan
 
GIT - DUG Antwerp
GIT - DUG AntwerpGIT - DUG Antwerp
GIT - DUG AntwerpKrimson
 
Git hooks for front end developers
Git hooks for front end developersGit hooks for front end developers
Git hooks for front end developersBradley Gore
 
Collaboration With Git and GitHub
Collaboration With Git and GitHubCollaboration With Git and GitHub
Collaboration With Git and GitHubAlec Clews
 
C初心者がbyebugにPR出した話
C初心者がbyebugにPR出した話C初心者がbyebugにPR出した話
C初心者がbyebugにPR出した話tzm_freedom
 
APIテストあれこれ
APIテストあれこれAPIテストあれこれ
APIテストあれこれtzm_freedom
 
Git session day 2
Git session day 2Git session day 2
Git session day 2Mosaab Ehab
 
SouthEast LinuxFest 2015 - intro to git
SouthEast LinuxFest 2015 -  intro to gitSouthEast LinuxFest 2015 -  intro to git
SouthEast LinuxFest 2015 - intro to gitedgester
 
CRuby_Committers_Whos_Who_in_2014
CRuby_Committers_Whos_Who_in_2014CRuby_Committers_Whos_Who_in_2014
CRuby_Committers_Whos_Who_in_2014nagachika t
 
ChatOps meetup: les humains parlent aux robots
ChatOps meetup: les humains parlent aux robotsChatOps meetup: les humains parlent aux robots
ChatOps meetup: les humains parlent aux robotsOlivier Jacques
 
Git session day 1
Git session day 1Git session day 1
Git session day 1Mosaab Ehab
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GITArpit Mohan
 

What's hot (20)

maksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your cimaksym vlasov - culture of git as roots of your ci
maksym vlasov - culture of git as roots of your ci
 
SCM Gitlab Advanced
SCM Gitlab AdvancedSCM Gitlab Advanced
SCM Gitlab Advanced
 
Ktor 101 (以 Ktor 實作 Website 範例)
Ktor 101 (以 Ktor 實作 Website 範例)Ktor 101 (以 Ktor 實作 Website 範例)
Ktor 101 (以 Ktor 實作 Website 範例)
 
ZSH and RVM
ZSH and RVMZSH and RVM
ZSH and RVM
 
GIT - DUG Antwerp
GIT - DUG AntwerpGIT - DUG Antwerp
GIT - DUG Antwerp
 
Git hooks
Git hooksGit hooks
Git hooks
 
Git hooks for front end developers
Git hooks for front end developersGit hooks for front end developers
Git hooks for front end developers
 
Collaboration With Git and GitHub
Collaboration With Git and GitHubCollaboration With Git and GitHub
Collaboration With Git and GitHub
 
C初心者がbyebugにPR出した話
C初心者がbyebugにPR出した話C初心者がbyebugにPR出した話
C初心者がbyebugにPR出した話
 
APIテストあれこれ
APIテストあれこれAPIテストあれこれ
APIテストあれこれ
 
Git hooks
Git hooksGit hooks
Git hooks
 
Git session day 2
Git session day 2Git session day 2
Git session day 2
 
Git! Why? How?
Git! Why? How?Git! Why? How?
Git! Why? How?
 
Golang preso
Golang presoGolang preso
Golang preso
 
SouthEast LinuxFest 2015 - intro to git
SouthEast LinuxFest 2015 -  intro to gitSouthEast LinuxFest 2015 -  intro to git
SouthEast LinuxFest 2015 - intro to git
 
CRuby_Committers_Whos_Who_in_2014
CRuby_Committers_Whos_Who_in_2014CRuby_Committers_Whos_Who_in_2014
CRuby_Committers_Whos_Who_in_2014
 
ChatOps meetup: les humains parlent aux robots
ChatOps meetup: les humains parlent aux robotsChatOps meetup: les humains parlent aux robots
ChatOps meetup: les humains parlent aux robots
 
Git session day 1
Git session day 1Git session day 1
Git session day 1
 
Git in 5 Minutes
Git in 5 MinutesGit in 5 Minutes
Git in 5 Minutes
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 

Similar to Git - Some tips to do it better

Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From GitChris Miller
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How tolanhuonga3
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Derek Jacoby
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2Derek Jacoby
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Git Obstacle Course: Stop BASHing your head and break down the basics
Git Obstacle Course: Stop BASHing your head and break down the basicsGit Obstacle Course: Stop BASHing your head and break down the basics
Git Obstacle Course: Stop BASHing your head and break down the basicsChris Bohatka
 
Bedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBeDjango
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practiceMajid Hosseini
 
Pimp my dev box (Friday Training at Itnig)
Pimp my dev box (Friday Training at Itnig)Pimp my dev box (Friday Training at Itnig)
Pimp my dev box (Friday Training at Itnig)itnig
 

Similar to Git - Some tips to do it better (20)

Git presentation
Git presentationGit presentation
Git presentation
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From Git
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Github basics
Github basicsGithub basics
Github basics
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Advanted git
Advanted git Advanted git
Advanted git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
git and github
git and githubgit and github
git and github
 
Git Obstacle Course: Stop BASHing your head and break down the basics
Git Obstacle Course: Stop BASHing your head and break down the basicsGit Obstacle Course: Stop BASHing your head and break down the basics
Git Obstacle Course: Stop BASHing your head and break down the basics
 
Bedjango talk about Git & GitHub
Bedjango talk about Git & GitHubBedjango talk about Git & GitHub
Bedjango talk about Git & GitHub
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Basic git
Basic gitBasic git
Basic git
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 
Git and git workflow best practice
Git and git workflow best practiceGit and git workflow best practice
Git and git workflow best practice
 
The hacker choice
The hacker choiceThe hacker choice
The hacker choice
 
Pimp my dev box (Friday Training at Itnig)
Pimp my dev box (Friday Training at Itnig)Pimp my dev box (Friday Training at Itnig)
Pimp my dev box (Friday Training at Itnig)
 

Recently uploaded

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 

Recently uploaded (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 

Git - Some tips to do it better

  • 1. GIT Some tips so we “GIT” it better then before...
  • 2. WHO AM I? @glamorous_be - PHP Developer (@kohanaphp) - jQuery lover - GIT freak - Founder @eidtickets - Owner Glamorous.be - President @jongvldwaregem Jonas De Smet (°86)
  • 3. A little background I learned git because of @kohanaphp his switch to git
  • 4. ... and with the love from @github If you don’t have a @github account yet, then this talk isn’t for you...
  • 5. ... and with the love from @github If you don’t have a @github account yet, then this talk isn’t for you...
  • 6. 5 MUST-DO’s as git user or you would better not start using git at all...
  • 7. 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!
  • 8. 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)
  • 9. 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)
  • 10. 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)
  • 11. 3. Use a remote repo if possible and probably many more...
  • 12. 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
  • 13.
  • 14.
  • 15.
  • 16. 5. Branch, branch and tag! Choose your own workflow Source: http://nvie.com/posts/a-successful-git-branching-model/
  • 17. 5 TIPS that will reduce the amount of WTF’s and hopefully making you commit better then before
  • 18. 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
  • 19. 2. Use git merge --no-ff You will not regret it if you want to revert it! Source: http://nvie.com/posts/a-successful-git-branching-model/
  • 20. 3. Use git add -i Becomes sometime you do different things together...
  • 21. 4. git submodule rm exists, right?
  • 22. 4. git submodule rm exists, right? No! $ vim .gitmodules $ vim .git/config $ git rm --cached path/to/module NO trailing slash! Commit your changes
  • 23. 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
  • 24. How to become an expert?
  • 25. ... 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/
  • 26. ... and use it, every day!
  • 27. Q&A Follow me at @glamorous_be Fork me on github.com/glamorous Some links on delicious.com/glamorous_be/git

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n