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

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 

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