You are not Logged In!

Public:GitHub

From Illini Solar Car Wiki
Jump to navigation Jump to search

For Managing GitHub see: GitHub Management

InfoIcon.png Note
This page is just generally about setting up and using Git and GitHub. See specific instructions for workflows on each repo in their subpages linked below.

GitHub is a website for hosting and working with Git repositories. Git is a distributed version control system for text based files (primarily software) created by the Linux Kernel development team. Unlike most version control systems, it is distributed which means that every single person has the full fledged repository on their machine and thus there is no single point of failure. For collaboration there need to be one copy of the repository that is the origin that is accessible to everyone to push/pull their changes to. For us, that is on GitHub. If you do not currently have a GitHub account you will need to make one. Please make sure your GitHub account has your illinois email address on it (either as primary or secondary) so that we can easily add your account.

GitHub adds many features on top of just git, including issue tracking and projects, Continuous Integration including GitHub Actions, Releases, and more. Below you'll find info for general use of git and links to pages for specific instructions for each of our repos. To get access to GitHub talk to an Electrical Lead or Telemetry Lead.

Active ISC GitHub Repos

Electrical

Telemetry

Shared

  • GitHub/CAN - defines our CAN Bus Specifications for firmware and CAN


Installing Git

Most of our team members use Git from the command line exclusively, and we recommend that you do too in order to git (haha) on the same page as everyone else.. It will help make sure that you learn and understand the tool and give you the full powers of Git, as most git GUI programs aren't able to provide all the features.

Linux

You are done, it ships with git - congrats! 😀


MacOS

Many Macs also ship with git, you can check by running git --version. It will either tell you the version or how to install it.

Windows

On windows you need to install git, we recommend git bash for windows:

  • Download Git Bash for Windows: https://git-scm.com/downloads
  • Run the Installer
  • When Adjusting your PATH environment, I recommend selecting "Use Git from Git Bash" and not using it from the Windows command prompt.
  • When Configuring Line Ending Conversion please use the default for your operating system unless you know what you are doing.

Using Git and GitHub

If you're new to git and/or github there are many resources on the internet to learn more about it. Watching some youtube videos on the basics and trying it out by creating your own repository is a great way to get started.

General Guidelines

  • Commit often (but not too often)
  • Make your commit messages useful
  • Pull often!
  • Keep your branches limited in scope
  • Name your branches and Pull Requests Nicely
  • Describe what you did on your Pull Requests
  • If you aren't sure what you are doing ask for help!
  • If you think you broke something talk to someone right away!
    • It essentially always fixable but we want to do so quickly so others don't run into problems or base their new work on broken things
Gitworkflow.png

How Git Works

To the right is a (large) diagram of git. The remote repository is the GitHub repository that you connect to via the lightning (internet). Before we discuss the local parts we need to briefly have an idea of how git stores information. Git does not store every single version of every single file. Instead it stores the "diff" (difference/changes) for each version in the history. This allows it to efficiently store the information of the full history without repeating and wasting a lot of data. This information is stored in the hidden git folders, so what you see for files on your computer is just your active workspace, but all the info about your local repository is there.

On your computer you will have 3 distinct areas:

  • Workspace
  • Staging Area
  • Repository

The Workspace

This is the files you see on your computer and where you are actively working.

Staging Area

Once you have some files ready to go you put them in the staging area. You stage a specific version of a file, Git will keep track of the specific version you stage (via `git add <filename>`) and further changes to that file will not be in the staging area until you stage the file again.

Local Repository

Once you have all the files for this change ready to go you can officially add it to the git history by putting it into your local repository. Next time you push it will also be added to the remote repo. Note that these don't have to be complete changes. You can commit partial changes or the various steps, and this is encouraged, so that you don't lose work and can rollback to intermediate versions later if something changes or goes wrong.

The diagram to the right also shows that commands to use to get between the different parts. Read our Git Cheatsheet for more on how to use each of this commands, I reccomend keeping this open to reference while looking through the cheatsheet.

Try it Out

Now that your know a bit about what is going on, why not try it out and see git/GitHub in action! A good way to do this is to do GitHub's guided hello world activity, this should take you less than 10-15 minutes!

GitHub Tips

Using Git Effectively is an important part of being a contributor to the Electrical and Telemetry groups. Here are some tips for doing so:

  • Make sure people can figure out who you are on git - either from a picture or your username being obviously related to you
  • Pay attention to the other pull requests and issues happening in the repos you work on
    • Its good to see what others are working on
    • See how reviews go and what is looked at
    • Give input!
  • Set up Personal Reminders for ISC: https://github.com/settings/reminders
    • The Illini Solar Car Organization on GitHub is linked to the ISC slack, you can set GitHub to send you daily summaries and/or real-time notifications for any of:
      • Your Pull Request being reviewed
      • Your Pull request failing a check
      • Your review being requested
      • And more!
    • We reccomend at least getting notifications for your PR being reviewed and people requesting your review on a PR, that way the info doesn't get lost in your email and you can respond timely!

Tutorials

Git is a super useful tool that is becoming ubiquitous with CS / ECE and more engineering fields. It is used for all sorts of things (not just code) . Version control is incredibly powerful, but because of that it can be hard to learn. Below are some recommended tutorials. Of course, as git was made for code, there is tons of info on the internet. Being good with git will be very helpful within jobs and academics.