Image by 4045 on Shutterstock

Why Would I Need to Use Git for a Personal Project?

Take Advantage of Branches, File Recovery, and Tracking

Bill Karwin
4 min readOct 5, 2022

--

https://pragprog.com/newsletter/
https://pragprog.com/newsletter/

A user once asked me:

I read at many internet sites and blogs that version control is great and that all developers need to use it.

But do I really need this given I usually work alone (freelancer). None of my clients ask me to use source control. Should I make the effort to learn Git or Subversion, or is it just a waste of time for me?

Any experienced software developer would say confidently that software developers should use source control in any case, but that alone is not enough of a reason. If all your friends jumped off a bridge, would you do the same?

Explaining why it’s a good idea is more effective than only making an unsupported assertion that it is. Many thousands of new software developers join the field every year, so we should take the time to be specific about why source control is important and worthwhile.

Following is a scenario that may illustrate the usefulness of source control even if you work alone.

Your client asks you to implement an ambitious modification to the website. It’ll take you a couple of weeks, and involve editing many pages. You start working.

You’re 50 percent done with this task when the client calls and tells you to drop what you’re doing to make an urgent but more minor change to the site. You’re not done with the larger task, so it’s not ready to go live, and the client can’t wait for the smaller change. But he also wants the minor change to be merged into your work for the larger change.

Maybe you are working on the large task in a separate folder containing a copy of the website. Now you have to figure out how to do the minor change in a way that can be deployed quickly. You work furiously and get it done. The client calls back with further refinement requests. You do this too and deploy it. All is well.

Now you have to merge it into the work in progress for the major change. What did you change for the urgent work? You were working too fast to keep notes. And you can’t just diff the two directories easily now that both have changes relative to the baseline you started from.

The preceding scenario shows that source control can be a great tool, even if you work solo. Source control can solve many problems for you. Using source control you can:

  • Use branches to work on longer-term tasks and then merge the branch back into the main line when it’s done.
  • Compare whole sets of files to other branches or to past revisions to see what’s different.
  • Track work over time (which is great for reporting and invoicing by the way).
  • Recover any revision of any file based on date or on a milestone that you defined.

Should you choose Git or Subversion? Today, in 2022, Git is the default choice for the majority of software development teams. Statistics about public source repositories show that Subversion was dominant until about 2014. Then for a few years Git and Subversion had similar popularity. By 2017, Git had become the top choice, and Git’s lead has only grown since then.

That said, if you work in a company that uses some other source control, you should be a team player and work with the system they have selected.

A good book about Git is Pragmatic Version Control Using Git by Travis Swicegood.

The most popular Git repository hosting service has been github.com for a long time, but there’s a growing movement to use other git hosting services, such as GitLab.com, CodeBerg.org, SourceHut.org, or even alternatives to self-host.

Bill Karwin’s new SQL Antipatterns book is now in beta with The Pragmatic Bookshelf. You can save 35 percent with promo code bksap1_medium_2022 now through October 31, 2022. Promo codes are not valid on prior purchases.

--

--