By Ev Bogue - May 3rd 2016
Git is a distributed version control system that keeps all of your changes on your local machine. It was invented by Linus Torvalds, and is used by almost all of the programmers in the world at this point.
These days I use Git for programming, writing, and website building. Which is almost everything.
For eaxmple The Art of Being Minimalist is checked into a private Git respository where it can be generated using a Node.js application at the same time as all of my other books.
While Git was invented for tracking changes in code, it's also valuable for tracking changes in any sort of text. This makes it a useful tool for writing as well.
Git is also useful for moving files between my local machine and my VPS (virtual private server), without losing any data.
Recently I started running my own Git server on the Internet at gitmx.com, similar to the centralized Github or decentralized-but-large Gitlab, but deployed using a small program called Gogs. Feel free to sign up for an account and use gitmx.com for your git repositories if you want. Or just stare at my code and writing via Git.
On a recent consulting call about programming basics, we unintentionally started talking a lot about the benefits of using Git for everything.
One of the issues with using Git is the initial learning curve is a bit high. Git is a command line utility and doesn't make any sense at all in the context of a GUI (graphical user interface). So while Git is an essential part of everyday life for programmers and other command line dwellers, Git is an adventure for people who are natives of GUIland.
Getting Git installed is easy on a Linux machine, as almost every package manager maintains the latest version. On Mac OS X or Windows you should use the installer from git-scm.com.
Once you have Git installed you use it from your command line with the following commands
Create a new directory
% mkdir new-project % cd new-project % git init
Create a new file using your text editor of choice, write something into the file.
% vim file.txt
Add the file to Git
% git add file.txt
Commit the file to Git
% git commit -m 'Added first file to git'
And amazing! You've almost learned all of Git. Next push your Git repository up to a Git server. Create a new repo on gitmx/gitlab/github and copy the http(s) URL
% git remote add origin http://gitmx.com/ev/new-project.git % git push origin master
It'll ask you for your username and password, and then push the repo up the Internet.
Now you have a Git repo online. To get your Git repo to a remote VPS, simply clone the repo down with
% git clone http://gitmx.com/ev/new-project.git
And your repo will be on your VPS.
Now you pretty much have Git down. To learn more dive into all of the amazing documentation available on the Internet surrounding Git! Or if you have questions email me, as I'm always happy to explain technical concepts via email: firstname.lastname@example.org
Hi! I'm Ev Bogue. I serve at a restaurant in Fayetteville, NC.
I no longer use email. Please use Decent to contact me.