Robin's Blog

Git helps me get round to using source control

I’ve always heard how source control should be used for every project, including those which you think are just going to be throwaway code. However, I’ve often not got around to doing this – if I write a piece of code in ten minutes, but it takes five minutes to set up a new subversion repository on my server, then it seems like a waste of time to set it all up (it probably isn’t, given how version control can help further down the line, but because of this perception it often doesn’t get done).

However, git has changed that. When working with git all I need to do is type git init and I have a brand new git repository in my folder. I can then quickly shove in a .gitignore file from my stash (acquired from this git repository), add all of the files (git add *) and commit. I can do anything I want with this repository without having to connect it to a remote server. If, later in the project, I want to put it all on a remote server, I can just create a new GitHub repository and add it as a remote.

As this is just so easy, I’ve put far more code into source control, and it’s really saved my bacon a number of times!

(Of course, this applies to other version control systems too – it’s just that I use git)

If you found this post useful, please consider buying me a coffee.
This post originally appeared on Robin's Blog.

Categorised as: Programming

Leave a Reply

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