Finally started to version control my files using Git

I’ve been aware of different version control systems since I started using Linux. Why? Often times I am asked to install the latest development version of a software as the last tarball (*.tar.gz) has not been updated for a while. I’ve pulled code most often using Subversion (SVN), Git, and CVS. Of the various version control systems, I must say Subversion is the most prevalent out there. However, I’ve heard many preach about Git, similar to people preaching about Emacs (me being one of them). Even though Git is not as “standard” as Subversion, I chose Git because

  1. many acquaintances I think highly of use Git,
  2. many tutorials out there (although this is true for most popular systems),
  3. Linux kernel is managed using Git, and
  4. existence of git-svn, so I can still use SVN through Git.

I will write more about my experience with Git on particular projects later (e.g., Git with SVN on R-Forge). For this post, I’ll just post some references I’ve used to learn Git and the common commands I use (reminder to self).

First, read this short tutorial to understand Git. Like the author described, most tutorials show you command. The author tries to explain the concept of version control and their principles in Git.

Try out Git on one of your projects (create a folder and create and edit some files).

Next, read the Git Magic book (online). It gives a good analogy of version control to video games, along with

Re-read how Git works, play with files, and Git Magic.

For Git and SVN, this site and this site helped me get started. Note: I did not use -s in the git svn clone. This is also a good intro to Git.

To undo what you’ve edited since the last commit, remember git reset --hard HEAD.

Once I get the command lines down well to know exactly what’s going on, I plan to incorporate magit, an emacs extension for git, into my workflow.

Now, my notes to remember:

 <pre class="src src-sh"><span style="color: #ff4500;">## </span><span style="color: #ff4500;">start version control in a project/folder</span>

git init git add … ## files, folders, etc. git commit -a -m “COMMENTS” ## commit

Uhh, how about just google “git reference card” to obtain this card and this card.

About Vinh Nguyen

Statistician

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>