View
3.312
Download
2
Category
Preview:
DESCRIPTION
Source code management and version control are absolutely essential to a successful software and web development project, especially when working with a team of developers. If your development workflow does not include Git, you're doing it wrong! Git it right! Git was first developed in 2005 by Linus Torvalds (yes, THE Linus Torvalds) as a distributed system for managing the development of the Linux kernel. Today, Git is used by companies and organizations large and small. According to the official Git webiste (http://git-scm.com/), Git is used Google, Micorosoft, Facebook, Twitter, and LinkedIn, just to name a few. Even the Joomla CMS and Joomla Platform teams now use Git. In this presentation, Cory Webb discusses Git and how his company uses Git to manage their web development workflow. He will go over some basic Git commands that every developer should know, as well as cover some popular tools for using Git locally and for hosting Git repositories. He will also open a discussion about how to overcome the limitations of Git, primarily when it comes to managing changes in the database between development and production servers.
Citation preview
manoscrafted.com/git-it-right.pdf
Who am I?
● Working with Joomla/Mambo since 2003● Founded Manos (formerly Cory Webb Media,
LLC) in 2008● Author of Beginning Joomla Website
Development (Wrox 2009)
Who are you?
● Developers/Programmers● Designers● Integrators
Agenda
● Why version control?● Intro to Git● Git Basics● Git Clients● Git Repository Hosting● Using Git for Joomla Projects● Questions
Why version control?
● Less of this: “I'm going to be working on template.css today, so nobody touch it!”
● More of this: “Let's all work on template.css today and use our version control system to merge our changes at the end of the day!”
Why version control?
● Easier to work as a team● Snapshots of your code at various stages of
development● Branching, staging and experimentation● Ability to revert back to previous versions
Intro to Git
● Offi cial website: http://git-scm.com● Distributed version control system● Enables team collaboration● Free and open source (GPLv2 license)● Used by Joomla, Google, Facebook, Microsoft,
Twitter, LinkedIn, Netfl ix, etc....● Seamlessly branch and merge code changes● Work locally
Intro to Git
● Multiple backups● Custom workflows● Data assurance● Code staging
Git Basics | Commands
● git clone
● git init● git status● git add . ● git commit -m “Comment about commit”
● git push● git pull● git merge
Git Basics | git clone
● Clone an existing Git repository● Creates an exact copy of the repository● Changes can be shared between the original
and the clone
● http://git-scm.com/docs/git-clone
Git Basics | git init
● Initialize a new git repository● Create a new project from scratch
● http://git-scm.com/docs/git-init
Git Basics | git status
● Returns the current status of the repository● Displays list of new, modified, and deleted files● Displays list of changes staged for commit
● http://git-scm.com/docs/git-status
Git Basics | git add
● Add changes to the staging area● Stage modifications (new files and changed
files) to be committed to the repository
● http://git-scm.com/docs/git-add
Git Basics | git commit
● Commits staged changes to the repository● Add a comment using -m “Comment”● Stage changes using -a after git commit
● http://git-scm.com/docs/git-commit
Git Basics | git push
● Updates remote repositories with local repository
● http://git-scm.com/docs/git-push
Git Basics | git pull
● Fetches a remote repository or local branch and merges changes with the local repository into the current branch
● http://git-scm.com/docs/git-pull
Git Basics | git merge
● Merges 2 or more development histories together
● http://git-scm.com/docs/git-merge
Git Basics | .gitignore
● File that specifies files within your project that Git should ignore
● Using the git status command will not list files from the .gitignore file
● Files listed will never be staged for commit or committed
● http://git-scm.com/docs/gitignore
Git Clients | Mac
● GitHub for Mac - Free - mac.github.com● Tower - $59 - www.git-tower.com● Gitbox - $9.99 / Free - www.gitboxapp.com● GitX - Free - gitx.laullon.com● SourceTree - Free - www.sourcetreeapp.com● Git-Cola - Free - http://git-cola.github.com/● SmartGit - $79 / Free - www.syntevo.com/smartgit
Git Clients | Windows
● GitHub for Windows - Free - windows.github.com● Git Extensions - Free -
code.google.com/p/gitextensions● Git-Cola - Free - http://git-cola.github.com/
● SmartGit - $79 / Free - www.syntevo.com/smartgit● TortoiseGit - Free - http://code.google.com/p/tortoisegit/
Git Clients | Linux
● Git-Cola - Free - http://git-cola.github.com/● SmartGit - $79 / Free -
www.syntevo.com/smartgit
Git Repository Hosting
● GitHub.com● BitBucket.org● BeanstalkApp.com● Assembla.com● CodebaseHQ.com● BareGit.com● Gitorious.org – RoR Git repo hosting app
Using Git for Joomla Projects
● Getting started● Establish your workflow● Deployment● Database issues
Git for Joomla | Getting Started
● Initialize the root directory of your Joomla project with 'git init' in your local web server (MAMP)
● Install Joomla● Set up your '.gitignore' file to specify files you don't
want to track● Add your files to the repository with 'git add .'● Commit your new files to the repository with 'git
commit -m “Initial commit”'
Git for Joomla | Getting Started
● Set up remote hosting for your repository● Push your local repository to the remote hosting● Each developer clones the repository to their
local systems
● TIP: Ignore the configuration.php file and let that be specific to each developer's local repo.
Git for Joomla | Establish workflow
● Subversion-style Workflow
Image from git-scm.com
Git for Joomla | Establish workflow
● Integration Manager Workflow
Image from git-scm.com
Git for Joomla | Establish workflow
● Dictator and Lieutenants Workflow
Image from git-scm.com
Git for Joomla | Deployment
● BeanstalkApp.com enables easy deployment to development, staging, and production servers
● Overwrite existing code files with the master repository once it is deemed ready for deployment
Git for Joomla | Database Issues
● Git does not track changes to a MySQL database
● Probably using different databases for each developer, the development server, staging server and the production server
● Development usually involves changing the database (adding articles, menu items, modules, etc. in Joomla)
● How do we deal with changes across so many different databases?
Git for Joomla | Database Issues
● Option 1: Point all instances of Joomla to the same remote database.
● Option 2: Manually track changes.● Option 3: Use a database synchronization tool such as
red-gate.com/products/mysql/mysql-comparison-tools/
● Solution may vary depending on the details of your project
Questions?
@corywebb @jlleblanc
Recommended