Git Processing 101
distributed version control for sketches
Processing Austin
$ whoami
@earthtravis
README.md
- Bachelor of Business
- Enterprise Experience
- Master of Technology
- Passion for Startups
Git
open.
fast.
scalable.
Save and Share
- Every directory is repository.
- history and version tracking
- Not dependent on network access or central server.
- connectivity != blocker
- Free software.
- GNU General Public License version 2
Back in the day
- FTP
- Copies
Do not make copies of sketches.
Make commits @ logical stopping points!
Collaboration
same files == version nightmare
- Different times
- Some overlaps
Revision History
Content Changes
- Who
- What
- When
- Why
Features
- local branching
- staging areas
- multiple workflows
Example: John Resig's port of Processing to JavaScript.
- Code
- Network
- Graphs
$ git log
- copyright holder of BitKeeper withdraws free use
- Linus Torvalds (Linux) builds something better
Priority
- Performance
His goal was for patches to take three seconds.
Wikipedia
Design Criteria
- Opposite of Concurrent Versions System (CVS)
- Distributed workflow
- Safeguard against corruption
Open Source
philosophy promoting universal access via free license to product's design or blueprint and universal redistribution of that design or blueprint, including subsequent improvements by anyone.
Wikipedia
Open Source
- Apache
- Linux
- Ruby
- WordPress
- Processing
- Arduino
- SuperCollider
OpenProcessing
Open Source Initiative
GitHub
- GUI
- Social Coding
Sign up for GitHub
Installer
Downloads
Exercise
- create
processing
repository on GitHub - Open Terminal
Set Up Git
Configure Username, Email and Password caching settings.
Clone repo.
Navigate to directory you want files stored in.
git clone <HTTPS clone URL>
$ git clone https://github.com/earth2travis/processing.git
See current state of project.
- $
cd processing
- $
git status
Update /flocking/flocking.pde
- Open flocking.pde in Processing IDE
- Change:
background(50);
-
To:
background(153, 204, 255);
- Save
To start tracking changes made to flocking.pde, add it to the staging area.
Return to Terminal
$ git status
$ git diff
$ git add flocking.pde
Move changes to repository running commit command and describing changes.
$ git status
$ git commit -m "Change background to blue."
View existing remotes
$ git remote -v
# origin https://github.com/earth2travis/processing.git (fetch)
# origin https://github.com/earth2travis/processing.git (push)
Change the 'origin' remote's URL
$ git remote set-url origin https://github.com/user/processing.git
replace user with GitHub username
# Verify new remote URL
$ git remote -v
# origin https://github.com/user/processing.git (fetch)
# origin https://github.com/user/processing.git (push)
Push tells Git where to put our commits.
- Remote (repo): origin
- Local (branch): master
- -u: Remember parameters, for origin and master.
$ git push -u origin master
Remember the workflow.
add, commit, push
Create branch to add feature or fix bug.
$ git branch add_trees
See branches.
$ git branch
Switch branches.
$ git checkout add_trees
Add background image.
- Open flocking.ide in Processing
- replace:
void setup()...
and
void draw()...
With
PImage bg;
void setup() {
size(1000, 563);
bg = loadImage("trees.jpg");
flock = new Flock();
// Add an initial set of boids into the system
for (int i = 0; i < 150; i++) {
flock.addBoid(new Boid(width/2,height/2));}}
void draw() {
background(bg);
flock.run();}
Take a look.
- Save flocking.ide
- Run sketch
Check changes.
$ git status
Track changes.
$ git add flocking.pde
Commit changes.
$ git commit -m "Add trees in background."
Switch back to master branch.
$ git checkout master
Merge changes from add_trees branch into master branch.
$ git merge add_trees
Delete add_trees branch.
$ git branch -d add_trees
Push to remote repository.
$ git branch
$ git push
add, commit, push
Fancy Log
$ git log --graph --decorate --abbrev-commit --all --pretty=oneline
Quick Wins
- Content, not files
- Opt-in, not opt-out
- Open, not locked
- Distributed, not centralized
- Conversations, not cut-offs
- People, not tools
- Journal, not backup
- Anywhere, not just online
Learn Free
Git in your browser with Try Git
Pro Git by Scott Chacon is available online.
Learn More
Code School
Cheat
Thank You
l4m
Resources
Attribution
- Pink Background: http://www.holographicwainscoting.com
- Trees: http://www.wallpapersmood.com/
Git Processing 101
By tRavIs McCutcheon
Git Processing 101
- 3,003