Git for Joomla! development
+
BLOG:Email: me@phproberto.com
About me
● PLT member
● CMS contributor
● JBS & JSST member
● PHP & JS developer
● Freelance...
What is git?
● Distributed Version Control System (DVCS)
● Compatible with all OS
● For team or single developers
● Record...
Version Control Systems
Nothing Copy & Paste Local VCS CVCS DVCS
Distributed Version Control Systems
● Easier to setup
● Less data loss risk
● Review changes locally
● Better speed
● Dev....
github
● Extend functionalities
● Save server management
● Visual interface
● Search issues / Google
● Comments
● Tag issu...
git & Joomla!
● Required to contribute
● joomla/joomla-cms -> CMS
● joomla-framework -> Framework
● joomla-extensions -> U...
Desired schema
local fork
upstream origin Your forkMain repo
Fork CMS repository
Fork view + clone URL
The terminal!
Why use terminal
● It works on all OS
● You end using it anyway
● You understand git
● You see cli output
git aliases
https://gist.github.com/phproberto/5066462
Clone fork locally
git clone {fork-url}
Upstream server
Add upstream server
git remote add upstream {upstream-url}
git branches
http://git-scm.com/book/en/Git-Branching-What-a-Branch-Is
git branch / git br
http://git-scm.com/book/en/Git-Branching-Branching-Workflows
git branch cool-branch
Create a branch:
C...
git merge
http://git-scm.com/book/en/Git-Branching-Branching-Workflows
Keep your main branch clean
● Usually “master” branch
● CMS uses “staging”
● git-3.x-dev for features
git fetch vs git pull
git fetch upstream
git merge upstream/staging
git fetch = download local copy
git pull upstream stag...
git log
git l (custom alias)
git log tricks
git l libraries/joomla/form/field.php
log for a specific file/folder:
search commits from one user:
git l -...
git status
Staging
Your first commit
Ensure that you are in a clean (and updated) branch
git checkout staging
Create a new branch:
git checko...
git add tricks
Add all files:
git add -A
Add only new files:
git add .
Add only modified files:
git add -u
Committing changes
Commit staged changes:
git commit -m ‘[imp] Code style fixes’
Always review status:
git status
Undo las...
Push branch to your fork
git push origin fields-error
local fork
upstream origin
Your forkMain repo
fields-error
Create a pull request
Pull request message
● Informative title
● Describe the issue
● Add screenshots (it’s free!)
● Add testing instructions
● ...
Pull request code
● Always review code!
● Avoid 10 commits for 10
lines (squash)
● Github Coding Standards
● Add minified/...
Be open to critique
● Improve as developer
● Avoid being blamed
● People invests time on you
● Ask help / guidance
● Learn...
Keep your PR up to date
● Add commits locally and push
● Rebase before pushing
● Squash if needed
git rebase
http://git-scm.com/book/en/Git-Branching-Rebasing
git rebase upstream/staging
git push origin fields-error --fo...
git rebase
http://git-scm.com/book/en/Git-Branching-Rebasing
NEVER rebase a collaborative branch!
Squash commits
git rebase -i staging
Squash commits
Result:
Questions?
Thanks for watching
Upcoming SlideShare
Loading in...5
×

Git for joomla! development #JAB14

957

Published on

How to use git to contribute to the Joomla! CMS development

Published in: Software
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
957
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Git for joomla! development #JAB14

  1. 1. Git for Joomla! development +
  2. 2. BLOG:Email: me@phproberto.com About me ● PLT member ● CMS contributor ● JBS & JSST member ● PHP & JS developer ● Freelance Twitter: @phproberto
  3. 3. What is git? ● Distributed Version Control System (DVCS) ● Compatible with all OS ● For team or single developers ● Record changes to files ● Revert files back ● Review changes over time ● See who changed what? ● Detect issue source
  4. 4. Version Control Systems Nothing Copy & Paste Local VCS CVCS DVCS
  5. 5. Distributed Version Control Systems ● Easier to setup ● Less data loss risk ● Review changes locally ● Better speed ● Dev. Independency DVCS benefits:
  6. 6. github ● Extend functionalities ● Save server management ● Visual interface ● Search issues / Google ● Comments ● Tag issues ● Stats ● Credits ● Integrations (Travis, Jenkins..)
  7. 7. git & Joomla! ● Required to contribute ● joomla/joomla-cms -> CMS ● joomla-framework -> Framework ● joomla-extensions -> Utilities ● joomla-cms -> Light core ● joomla-projects -> Parallel projects
  8. 8. Desired schema local fork upstream origin Your forkMain repo
  9. 9. Fork CMS repository
  10. 10. Fork view + clone URL
  11. 11. The terminal!
  12. 12. Why use terminal ● It works on all OS ● You end using it anyway ● You understand git ● You see cli output
  13. 13. git aliases https://gist.github.com/phproberto/5066462
  14. 14. Clone fork locally git clone {fork-url}
  15. 15. Upstream server
  16. 16. Add upstream server git remote add upstream {upstream-url}
  17. 17. git branches http://git-scm.com/book/en/Git-Branching-What-a-Branch-Is
  18. 18. git branch / git br http://git-scm.com/book/en/Git-Branching-Branching-Workflows git branch cool-branch Create a branch: Create and enter in a branch: git checkout -b cool-branch Delete a merged branch: git branch -d cool-branch Delete branches even not merged: git branch -D cool-branch Default list branches
  19. 19. git merge http://git-scm.com/book/en/Git-Branching-Branching-Workflows
  20. 20. Keep your main branch clean ● Usually “master” branch ● CMS uses “staging” ● git-3.x-dev for features
  21. 21. git fetch vs git pull git fetch upstream git merge upstream/staging git fetch = download local copy git pull upstream staging git pull download and merge remote content merge manually
  22. 22. git log
  23. 23. git l (custom alias)
  24. 24. git log tricks git l libraries/joomla/form/field.php log for a specific file/folder: search commits from one user: git l --author=”Roberto” search in commits messages git l --grep=”internet explorer”
  25. 25. git status
  26. 26. Staging
  27. 27. Your first commit Ensure that you are in a clean (and updated) branch git checkout staging Create a new branch: git checkout -b fields-error {edit files on your IDE} Staging files: git add templates
  28. 28. git add tricks Add all files: git add -A Add only new files: git add . Add only modified files: git add -u
  29. 29. Committing changes Commit staged changes: git commit -m ‘[imp] Code style fixes’ Always review status: git status Undo last commit without losing changes: Amend files to last commit: git commit --amend -C HEAD (alias “git amend”) git reset --soft HEAD^ (alias “git undolast”)
  30. 30. Push branch to your fork git push origin fields-error local fork upstream origin Your forkMain repo fields-error
  31. 31. Create a pull request
  32. 32. Pull request message ● Informative title ● Describe the issue ● Add screenshots (it’s free!) ● Add testing instructions ● Document features ● Comment if it’s a WIP ● Mention people if you need help
  33. 33. Pull request code ● Always review code! ● Avoid 10 commits for 10 lines (squash) ● Github Coding Standards ● Add minified/unminified assets ● Compile LESS
  34. 34. Be open to critique ● Improve as developer ● Avoid being blamed ● People invests time on you ● Ask help / guidance ● Learn for free!
  35. 35. Keep your PR up to date ● Add commits locally and push ● Rebase before pushing ● Squash if needed
  36. 36. git rebase http://git-scm.com/book/en/Git-Branching-Rebasing git rebase upstream/staging git push origin fields-error --force
  37. 37. git rebase http://git-scm.com/book/en/Git-Branching-Rebasing NEVER rebase a collaborative branch!
  38. 38. Squash commits git rebase -i staging
  39. 39. Squash commits Result:
  40. 40. Questions? Thanks for watching
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×