Version control is a must for any professional web developer, frontend or backend.
There are many ways to setup Git, but in my talk, the aim was to cover the simplest approach possible so folks could get set up quickly.
To view the complete tutorial, visit: http://frankiejarrett.com/wordcamp-kc-version-control-using-git/
3. 1. Tools you need (free)
2. Basic CLI commands
3. Basic Git commands
4. Setup and use a repo
Version Control Using Git
Frankie Jarrett
@fjarrett
4. Frankie, I want to use
version control but…
it’s too complicated.
Version Control Using Git
Frankie Jarrett
@fjarrett
5. Frankie, I want to use
version control but…
I’m set in my ways.
Version Control Using Git
Frankie Jarrett
@fjarrett
6. Frankie, I want to use
version control but…
I don’t know where to
start.
Version Control Using Git
Frankie Jarrett
@fjarrett
7. YOUR LIFE
CAN BE CHANGED
TODAY
Version Control Using Git
Frankie Jarrett
@fjarrett
8. Why use command line?
But I don’t do server ops!
GUI == Graphic User Interface
CLI == Command Line Interface
GUI’s are limiting. The command line is
freedom, control and speed.
After a while you will find yourself feeling
slowed down by your mouse and craving the
terminal.
Is there a GUI option for using Git?
As far as you’re concerned, no there isn’t.
Version Control Using Git
Frankie Jarrett
@fjarrett
9. POSIX
POSIX == Portable Operating System Interface
● Unix
● Linux
● Solaris
● BSD
● Darwin (Mac OS X)
POSIX basically means that these operating
systems use the same utility interface.
So the CLI commands look the same, and
work the same, across all of these systems.
Version Control Using Git
Frankie Jarrett
@fjarrett
10. Windows is not a POSIX-compatible
operating system, so it’s command line tools
aren’t quite the same.
If we were .NET developers, then we would
have to use Windows.
But we are WordPress developers, so it’s
likely that our web servers are running some
form of Linux.
The point of local development is to mimic
live environments as much as possible.
Still using Windows?
Windows != POSIX
Version Control Using Git
Frankie Jarrett
@fjarrett
11. Our Toolbox
Everything is free and comes in easy-to-install packages
Version Control Using Git
Frankie Jarrett
@fjarrett
● Xcode 5.1.1
○ Git
● iTerm2
We’ll be running these on OS X Mavericks (10.9.3)
12. ● Change directories: cd wp-content/themes
● Shortcut to your home directory: cd ~
● Go up one directory: cd ..
● List: ls or ls -la
● Create a file: touch filename.txt
● Edit a file: nano filename.txt
● Clean up our terminal view: clear
Protip: Tab-completion is your best friend!
Easy POSIX Commands
A few CLI tips to hit the ground running
Version Control Using Git
Frankie Jarrett
@fjarrett
13. 1. Add our Name and Email to the Git config on our computer
2. Create an SSH Public Key on our computer
3. Add our Public Key to our account profile on GitHub.com
4. Clone a repo onto our computer using SSH
5. Commit and push changes back to GitHub.com
Protip: Git != GitHub.com
Link to GitHub over SSH
SSH == Secure Shell
Version Control Using Git
Frankie Jarrett
@fjarrett
14. ● See your changed files: git status
● Queue up files: git add -A
● Make a commit: git commit -m ‘Fixed a broken footer link’
● Push our commits to GitHub.com: git push
● Pull down the latest from GitHub.com: git pull
● Switch branches: git checkout branchname
Protip: Go bookmark GitRef.org as a handy reference!
Easy Git Commands
A few Git CLI tips to hit the ground running
Version Control Using Git
Frankie Jarrett
@fjarrett