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
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2Derek Jacoby
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Derek 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
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
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

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

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