3 Reasons Students Should Use Git and GitKraken

3 Reasons Students Should Use Git and GitKraken

Streamlining student workflows

Unless you can write something perfectly the first time, you need to have a version control system. A version control system (VCS) is a tool that helps keep track of changes across versions of a file or group of files.

For most people, their first VCS is duplicating the file with a different file name. If you’re writing a document, this might look like having different files named outline.docx, draft.docx, draft-v2.docx, draft-v3.docx, and final-draft.docx. This is a perfectly valid VCS, and it works well for simple workflows. However, life isn’t always simple, and complicated workflows are made less cumbersome with a robust VCS.

While there’s no one-size-fits-all solution for organizing files, Git is a great choice for many workflows. Git might not transform your life, but it will change your hard drive!

Git has established itself as the most popular VCS. But despite its profound usefulness, it just hasn’t made it into the high school curricula yet, and students aren’t using this amazing tool for their academic workflows.

While Git can be challenging for the uninitiated, a user can get up and running in almost no time if they install a well-designed Git graphical user interface (GUI) like GitKraken.

I love the visual tree that GitKraken provides.

I’ve been working with Git ever since high school, and despite years of experience, I still find myself using a GUI to streamline many of the workflows I use in grad school. I’m pursuing a PhD in Electrical Engineering at Stanford University, investigating how lasers can be used for inertial navigation of aircraft. My research seeks to make fiber optic gyroscopes more accurate and less expensive.

In this article, I will share three Git workflows that Git and GitKraken have made much more streamlined. While one could use any Git client for these workflows, in my experience, GitKraken stands out as the most elegant solution for cross-platform version control.

1. Versioning Code for Research Experiments

If you’re a grad student, the odds are pretty good that you’re doing research. If you’re a grad student and you’re reading this blog, the odds are pretty good that you write code for your research.

My research project involves an algorithm that is used over and over again. The MATLAB code for the algorithm was written by a grad student over five years ago and has since been improved by other grad students. Every so often, when we are comparing experimental results with previous results, we ask the question: “which version of code created these plots and got these figures?”

For a while, when a student would update the algorithm, they would just include a comment at the top of the file, such as this:

% Title: Allan Variance Calculator
% Author: Grad Student A
% Modified to allow for different types of optical sources. – Grad Student B, 8 April 2014.
% Optimized nested-loop for faster performance with large datasets. – Grad Student C, 21 October 2016.

func foo(bar)

The problem with this approach is that you lose the original code and can’t go back to it if something breaks. One could preserve the original code in another file such as script.m, script_v2.m, script_v2_grad_student_a_edits.m, but this approach quickly becomes unwieldy.

This is a use-case where Git shines. Suppose I was looking at a dataset that was created back in 2013, and wanted to recreate the plot using the same code the 2013 grad students used.

I could type git log into my terminal, and dredge up the name of the commit that was used in 2013, and then type git checkout <commit name> to temporarily use the code that those students used. Afterward, I could type git checkout HEAD to restore back to the current version. This workflow is much easier and makes it a breeze to compare the outputs of all the different versions of a script.

GitKraken is indispensable for debugging complicated programs for school assignments, cherry picking, and committing hunks of a file.

GitKraken doesn’t support checking out old commits, but it does make viewing changes across the entire directory—and in single files—heaps easier than remembering the dozens of arguments for git log.

2. Versioning Code for LaTeX Publications

There are lots of reasons to use LaTeX for writing in grad school. If you’re writing a short and simple document, Google Docs is usually sufficient. But for more complicated documents, LaTeX is unparalleled in its support for vector drawings, equations, and reference management.

Because LaTeX is a programming language, it lends itself particularly well to version control—so much so that popular LaTeX hosting sites like Overleaf provide Git repositories for each LaTeX project.

When I write, I hate to throw away paragraphs during the revision process. For a long time, I would strike out large sections in my Word documents or I would keep separate files full of paragraphs that I had removed while editing, just in case I ever wanted to bring them back in later versions.

In LaTeX documents, it was even worse: my code was stuffed with vast sections of commented-out paragraphs, interspersed only by the occasional uncommented section here and there.

When I introduced Git into my workflow, I found I could delete these unused paragraphs out of my documents, and if I ever needed to go back to them, they would be sitting in previous commits. As the clutter in my drafts decreased, the readability increased, and I was always confident I could restore a previous “working draft” within seconds if needed.

For collaborative writing, Git works well when you want to merge changes from different users.

For text files, Git automatically does most of the merging for you automatically. The only time where user intervention would be required is if two edits were made to the same paragraph, in which case the user couldn’t merge the two automatically. In these cases, using a GUI saves a lot of time. GitKraken has a beautiful in-app merge tool to make it easy to resolve merge conflicts.

3. Building Your Code Résumé on GitHub

Eventually, students graduate and enter the workforce. I study at Stanford University, in the heart of Silicon Valley, and having coding skills on your résumé upon graduation is paramount for most of the big companies in the area.

GitHub has become the platform of choice for showcasing coding projects to potential employers. So, with that in mind, I try to make a point of publishing code for school projects on GitHub whenever I can (with the notable exception of homework assignments, where it would violate academic integrity policies).

Knowing that my code will be published on a public website forces me to write better code.

I’ve found that I tend to write descriptive comments, use best practices, and get in the habit of organizing my changes in small commits. This makes every school project an opportunity not only to earn a high mark in my class, but also to practice for a successful career in coding if I want to pursue that route down the road.

I find that only about half of my personal code review happens when I’m in my editor. When I’ve finished writing my changes, and the code works the way I want it to, I’ll fire up my Git GUI and read over what the commit will look like.

It’s at this point that I start seeing all the styling errors and unclear comments, and I go back and fix-up my code. I’ll also find some times that a commit could be broken into two different commits. For example, I’ll split the changes from a “fixed button and updated algorithm” commit, into a “fixed button” commit and an “updated algorithm” commit.

Why Should Grad Students Use Git?

I would recommend using Git if any of the following are true for you:

  1. You manage a repository of code for an ongoing experiment or project.
  2. You write a lot of complex or collaborative documents in LaTeX.
  3. You might need a portfolio of coding projects in the future.
Git is a powerful tool, but it can have a pretty steep learning curve. Using a Git GUI simplifies the workflow and makes using Git a lot more intuitive.

After comparing different GUIs, I switched to using GitKraken for all of my own projects, and it’s the GUI that I recommend regardless of OS or prior experience with Git. It doesn’t support detached heads or issue tracking yet, but that doesn’t keep it from being the best Git GUI out there for versioning code—both in and out of grad school.

I got started with GitKraken Pro and GitHub through the Student Developer Pack. With the pack, students get free access to the best developer tools! GitKraken Pro includes all the regular GitKraken features, plus things like an in-app merge conflict output editor and multiple profiles. And GitHub provides unlimited private and public repositories. Eventually, I will explore Stripe and Travis CI, which are other valuable tools in GitHub’s Student Developer Pack.

Stay on the cutting edge of software development by getting innovative tips, trends and stories delivered to your inbox every month!

Agile project management software
Plan, develop, review, and ship fast

Visit Axosoft.com

The downright luxurious Git client
For Windows, Mac & Linux

Visit GitKraken.com