Best practices for version control of firmware?

I’m confused about how to version control my firmware edits.

I switched to dvorak and activated the oneshot plugin, in this file: $SKETCHBOOK_DIR/hardware/keyboardio/avr/libraries/Model01-Firmware/Model01-Firmware.ino.

Before I start making more modifications, it would be nice to know I can still git pull from the master for updates, and that I’m making changes incrementally.

It was quite confusing to get to this point and I want to avoid such a large cognitive load in the future.

Thanks!

There are a few options, depending on what you want to accomplish. You can branch off, or fork the factory firmware, allowing you to pull any changes. Or you can go entirely separate. Both have their pros and cons.

Since you said you want to pull for updates, the easiest would be to fork the repository, create a branch of your own (git checkout -b lyfos, for example), add back the original repository as a remote (git remote add upstream https://github.com/keyboardio/Model01-Firmware.git), and you’re done.

You can then git pull upstream master to pull in new changes from the factory firmware, and when you push, you’ll push to your own repo, your own branch.

2 Likes

Or you can skip forking the repository on GitHub, and just create your own branch in you local clone:

git clone --recursive https://github.com/keyboardio/Arduino-Boards.git
cd Arduino-Boards/libraries/Model01-Firmware/
git checkout -b <name>

You can then pull changes from master, and merge them into your own branch.

2 Likes

The advantage of forking is that you can push the changes back, so you have a backup copy, something to show when asking for help, and a number of other reasons. :wink:

1 Like

Absolutely. But you don’t need to create a GitHub fork (or even an account) first – you can just clone the master repository, make a branch, commit changes, et cetera, and then create a fork on GitHub, add it as a remote, then push your branch to it.

I think this is a better order of operations, because it’s fewer steps for someone to get started with the primary task of editing their own sketch, and leaves the optional stuff for later.

1 Like