Chomper Stomping jQuery/JavaScript/CSS 3/HTML 5, Java/PHP/Python/ActionScript, Git, Chrome/Firefox Extensions, Wordpress/Game/iPhone App Development and other random techie tidbits I've collected

19Oct/100

Git it now?

gitCommitManagement


Git is amazing. The problem is, it's hard for a lot of people to get git. Specifically the remotes part. If you are used to CVS or SVN (Subversion) you're probably used to the idea that when you "commit" something it just flies out to the server and sits there available to anyone else with access to that server. Git doesn't do this.

Git is a distributed version control system, which means you have the entire project and the entire history of the entire project (or at least the branch you are on) sitting on your machine when you checkout the project(branch) from the server. So, when you "commit" something, you're really just creating a new version (kind of like timestamping a state of code and saving it) on YOUR machine. The remote server knows nothing about it. A lot of people new to git mistakenly think that "add" sort of saves a version of something on your machine and then commit sends it out to the server. Not so.

To help, I've created this image:

add: This takes the "work" off of your "work bench" and puts it on the "loading dock" (index).
commit: This takes everything on the "loading dock" (index) and puts it in a "crate" (commit) and places it on the "truck" (history).
push: This tells the "truck" (history) to drive itself to the "warehouse/hub" (remote) [and drop off copies of everything and come back] .

stash: This takes everything on your "work bench" and places it in a "box" (stash) on the side.

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.