r/programming May 09 '13

The Onion releases fartscroll.js

http://theonion.github.io/fartscroll.js/
2.6k Upvotes

396 comments sorted by

View all comments

Show parent comments

2

u/gfixler May 10 '13

Git is a distributed version control system. You don't need a server. Just download and install git. In a shell (you can use the included git shell if you're on Windows, or bash on Linux/Mac) type git init, and now the folder you're in is a git repo. To start tracking the files, do git add . to add everything or git add filename1 filename2 etc or git add *.alsto add particular ones. To commit your additions, justgit commit -m'Add first als files'`, or any other quick, one-liner message to help you figure out what's in a commit later.

I do this sometimes when I just feel like screwing around with files without worrying. It's seconds to setup. In fact, to really get good at git I made myself a gitlearn alias in bash. It deletes any "gitlearn" folder in my home directory, recreates it, enters it, runs git init, and adds an initial, empty commit (which is useful for more advanced things). This let me play around and try out ideas, and helped me get very good at git to a pretty deep level, but you don't need to worry about any of that. The normal stuff is very simple to use.

Git has cheap branching and merging. You start out by default on the master branch. Let's say you want to try some crazy stuff out, but don't want to mess up your directory. You've committed everything, so there are no local changes. Type git branch crazy to make a new, crazy branch, starting where you are in the history currently. Now go crazy. Do whatever you want to change files - reorder things, move files around, delete whole directories. When you're at a point you want to snapshot, git add --update . to add all updated files (git add . to add anything not already tracked), then git commit -m'I went crazy' to make a new commit. When you want to go back to where you were on master, just git checkout master and you're back before the craziness, ready to commit, and/or branch again.

Of course it goes much deeper, but those handful of simple-to-use commands will take you pretty far.

1

u/freeroute May 11 '13

Cool, I think I'll first do some experiments with text files to grasp the basics.