Want to Learn Something New? Learn Git!

If you'd come to me as a networking engineer and say “there's one new thing I want to learn that's outside of my $dayjob” I'd probably say “invest some serious time into learning Git (beyond memorizing the quick recipes) if you haven’t done that already”

Full disclosure: not so long ago I tried to avoid Git as much as possible… and then it suddenly clicked ;)

First step: you need version control. I hope we’re all beyond this step, so I won’t spend time telling you why this matters. You’ll figure it out the first time you’ll save a mangled file and realize you have no backup.

You don’t need a fancy tool at this step. It could be something really simple like Dropbox versioning.

Second step: you need to know what changed. You’ve probably experienced that moment when nothing works… and yet everyone claims nothing has changed. Having a decent version control software that helps you figure out who changed what at what time is a gift from heavens in those moments.

Trust me, you need such a tool even if you’re a lone wolf (or a one-man IT team). Being able to figure out what changes you made always beats the alternatives.

I did tell you to keep all your files under version control, right? Without that discipline no tool can save the day.

Third step: teamwork. There are tons of version control tools on the market, and most of them use the same process: when you need to change a file you grab it, and nobody else can touch it until you release it. Such an approach would never work for massive collaboration projects like Linux kernel (the project that Git was written to handle), so it’s no wonder that Git doesn’t have the same limitations.

You can change whatever file you want with Git, and it will happily merge your changes with changes made by other people as long as they don’t overlap… and assuming you use text files. One more reason why YAML is better data store format than Excel spreadsheet ;)

Cherry-on-the-cake: branches. Having a distributed teamwork tool is nice, but I usually work alone and was pretty happy using Subversion. However, once Scott Lowe demonstrated Git branches during the Building Network Automation Solutions online course I was totally hooked.

Imagine you’re changing configuration files, and have to switch over to the “public” version to do some troubleshooting. Git can do that in seconds.

Imagine you want to try out several ideas, but are not sure whether they’ll work. Git allows you to create as many branches as you need, and in the end cherry-pick the changes from individual branches when merging them into the final solution… or as one of the attendees of the network automation online course said “So I can stop naming python files 'script.1.1.py':) ?

Finally, you’ll benefit from using Git even if you’re not doing any network automation. Leslie Carr had a great presentation at RIPE71 explaining how you can use Git to manage configuration files.

Persuaded? I collected Git resources I found useful as the additional recommended self-study materials for the network automation course and you get access to Scott’s presentation and recording of this talk as soon as you register for the course.

This blog post was initially sent to the subscribers of my SDN and Network Automation mailing list. Subscribe here.

3 comments:

  1. Hi Ivan, I just found your blog - really interesting articles! I highly recommend you the free Pro Git [1] book, available in English and German. For practice there are two great interactive visual tutorials for git, see Git Real [2] and Learn Git Branching [3].

    [1] https://git-scm.com/book/en/v2
    [2] http://gitreal.codeschool.com/levels/1/challenges/1
    [3] http://learngitbranching.js.org/
  2. Hi! Glad to hear you like my blog ;))

    The Git Pro book is already on the "recommended self-study materials" list. Honestly, my personal recommendation would be not to go for any tutorial etc. but to invest time into reading that book. Yeah, I know that doesn't fly well today...
  3. Completely agree with you. Git is a great tool for version control. If someone wants to learn Git, a great place is to start with a tutorial that is aimed at beginners, like this one: https://www.cloudways.com/blog/git-tutorial-for-beginners-version-control/
Add comment
Sidebar