Skip to content

Instantly share code, notes, and snippets.

@ecridge
Last active October 21, 2015 17:29
Show Gist options
  • Save ecridge/1ebcd5a9200877e3e83a to your computer and use it in GitHub Desktop.
Save ecridge/1ebcd5a9200877e3e83a to your computer and use it in GitHub Desktop.
SCM guide for Hackspace 2015/16.

Source Code Management

SCM is a way to keep track of changes to project source code over time and when worked on by multiple people. Git is one of the most popular version control systems, especially on Unices like GNU/Linux.

If you haven’t used Git before, Try Git is a pretty good place to start, and GitLab’s workflow video is useful too.

Installing Git

GNU/Linux

$ sudo apt-get install git

(or whatever package manager you use)

OS X

Install the Homebrew package manager, then:

$ brew install git

Windows

Download Git for Windows, which will give you the Git Bash POSIX emulator to type commands into.

Using GitLab

The GitLab project group is here: https://gitlab.com/groups/PiONEERS.

The idea is that the person working on a specific part of the software (image processing, map making, etc) makes a project repository for that code and maintains it.

  • When you are working on a repo that you maintain, make your commits to a feature branch in that repo and send yourself a merge request when you are ready to add your changes into master. Doing this (instead of committing directly to master) groups your changes together and makes it easier for others to keep up.

  • When you are working on a repo that someone else maintains, make your commits to a feature branch in your fork of the main repo, and send a merge request to the repo maintainer when you want your changes added into master.

If someone else merges changes into the master branch while you are working on a feature branch, you will need to pull those changes into your local master and rebase your feature branch against it before merging:

On branch some-feature
$ git pull upstream master
$ git rebase master
$ git push -f origin some-feature

upstream generally refers to the main repo, and origin generally refers to your personal fork, though you can call them whatever you like. The -f flag causes the push to overwrite commits on your branch on the server, which is necessary because the rebase will have changed commit ordering. This is fine because you’re the only one working on the branch, but you should never force push to master ’cause that will mess things up for other people.

If you’re reading this wondering what the hell is going on, it will make more sense when you actually come round to doing it. There are also plenty of guides around on the internet, or you can just message/email me if you get stuck.

SSH Keys

SSH keys provide authentication for push/pulling from the group repos. You'll need to add one to your GitLab account.

  • GitHub has a pretty good guide on key management, just follow it and paste your public key into GitLab instead.

(We'll also need to create a key pair for the Pi so that it can download and run the code.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment