Arduino And Git: Two Views

You can’t do much development without running into Git, the version control management system. Part of that is because so much code lives on GitHub which uses Git, although you don’t need to know anything about that if all you want to do is download code. [Dr. Torq] has a good primer on using Git with the Arduino IDE, if you need to get your toes wet.

You might think if you develop by yourself you don’t need something like Git. However, using a version control system is a great convenience, especially if you use it correctly. There’s a bug out in the field? What version of the firmware? You can immediately get a copy of the source code at that point in time using Git. A feature is broken? It is very easy to see exactly what changed. So even if you don’t work in a team, there are advantages to having source code under control.

If you are already using a more advanced IDE, Git is probably integrated into your environment, or, at least, it could be. If you are allergic to the command line, there are plenty of GUI tools to use Git, also. One nice thing about Git is that your local repository is just a directory. You don’t need to stand up a special server or anything to use it.

We don’t think it is directly related, but [Andreas] recently had a video on Git and Arduino. It isn’t as detailed, but it does have some good stuff and is worth the time to watch. You can see it below.

We’ve used Git for some odd things in the past. Note that Git is the version control system while GitHub is a website. However, if you are a hardcore command line user, you can manipulate GitHub from there, too.

16 thoughts on “Arduino And Git: Two Views

  1. Honestly, even non-devs should be using Git. It’s also good for things like writing, where instead of working on a completely new draft, you might prefer an iterative process (like me), and using Git for version control can be incredibly handy. There are a ton of applications completely outside of software development where version control would be really useful.

    1. Yup! I like it for maintaining my docs, and I know a few professionals and academics who use it to maintain research and data tables.

      I’ve even recommended it for photographers and artists before, because it allows them to roll back changes to digital work that they’ve changed their minds on.

      You don’t have to use GitHub or GitLab or whatever, though. You can actually create a repo on any drive, so you could have it on a NFS if you wanted.

    2. Whenever someone asks what their first language should be, I usually say Git.

      With git you won’t break stuff and not know what you did.

      Also, if you learn git at the start of your programming journey, you’ll get a head start on industry best practices and be better able to figure out how seriously you want to take this.

      For me, programming took an few months to a year to learn the basics, then a few years to unlearn the hacky habits, and then I really started making progress.

      When you’re new, you write JSON parsers in C. You invent your own data serialization formats. You don’t bother learning the debugger. You make your own “Language” interpreted using string splits and regex. You don’t try to get to 0% warnings.

      VCS is one very useful way to break out of beginner level hacking and start moving towards what pro engineers do.

    3. Can I get an amen! Back in the bad old days Visual Source Safe saved our corporate bacon when several tech writers had their network storage go boots up just a bit too close to deadline.

    4. i agree git is super useful for all sorts of tasks. but selling git to non-devs is a challenge. i find it very easy to use today but my introduction to it was a little difficult, and for a lot of people it is *very* difficult. in particular, there are a lot of people — especially in the sciences in academia — who are now using git every day but don’t know how to do so! they’re in a constant state of confusion or frustration.

      it seems like a hurdle that should be surmountable but it’s a real challenge

      1. Thank you for saying this.

        Pros may love it, but for occasional and casual users GitHub is a PITA. Several that I work with have gone the full-on soup-nazi route with Github.

        There’s an old programming paradigm that “simple things should be simple; complex things should be possible”. GitHub seems to have take the opposite approach.

  2. GIT is incomplete and that drives us to GITHUB and other siblings of evil. Better run your own CGIT, GOGS, GITEA, … at home and only push a mirror on sites run by the dark side of the source.

    If you only GIT for yourself and don’t need issues and PRs, even plain GIT and optionally a simple GUI for it may be enough. You can look at FOSSIL too, which only is not a reasonable choice if you want to manage really big stuff with it. I’ve seen FOSSIL repositories that are >10times as big as their GIT siblings. But you get everything in FOSSIL: VCS, issues, WIKI, chat. forum, … all per single repo and in most cases our private projects won’t be of that size that’s too much for FOSSIL.

    OTOH the world speaks GIT. FOSSIL seems to have understood that and increasing compatibility with GIT is on their list. Or was, when I looked for it the last time.

    As happy end:

    https://xkcd.com/1597/

    I feel that. Been there … I always need to grab my cheat sheet (file) if e.g. I want to checkout a PR directly, but with my cheat sheet I get along with (G)it. Allow yourself an own cheat sheet and all will be ok… just try!

    1. +++ to Fossil, ( https://fossil-scm.org/ ). Do check it out, their website is the fossil repository for fossil itself, so they eat their own dog food, twice really. SQLite uses fossil in their development and fossil uses SQLite as the “engine” for the version control.

      No it’s not perfect, There’s no Tortoise-like grahical tool to do commits etc, but it does have a graphical interface for the version tree, tickets and the rest of the features. You can see the interface from their site, as said it is the fossil repo itself.

      Personally the reliable VCS, tickets and wiki are the best features for me. Not that i’m a power user. I’m a pretty lightweight user of any version control. So find out yourself if it works for you.

      There’s also a repository hosting service for your projects, if you want to use one ( https://chiselapp.com/ ).

    1. I use GIT pretty much like in the XKCD above, so I can’t help you with info. But I will say that I use TortoiseGit for windows. No need to use the command line.

    2. The only unix-only command there is “ls” which is unix for “dir”. Other commands are git commands.
      Ignore the “drtorq%”, that’s just the prompt, while windows(dos) shows the current path instead ( e.g. “C:\>” )

  3. Several years ago I encountered a comment that resonated with me: version control is a time machine! Not only does it help find bugs, it enables you to keep track of progress as well. It can also be used as a multiverse: if you need two versions of something. you could maintain them.

    When I worked on my dissertation (written in LaTeX), I accidentally stumbled onto a “version control” system I called Roman Version Control. Whenever I got my dissertation to a stop I liked, I would rename all the files involved, tack a Roman Numeral to the end of the filename (eg, Dissertation-IV.tex), and then work on that version.

    I even used that “system” for a personal project!

    After I graduated, I was eventually hired to work on a website that didn’t have version control, and even though I had never heard of it at the time, in retrospect I wish it did. It would have made some harrowing situations quite a bit less harrowing!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.