Resources for onboarding to MScA Robotics
Git is a version control tool. With it you can track all your changes in a codebase and know when, who, and why that line of code was put there. This makes running and debugging software much easier. It also unlocks collaboration between team members.
Github has an excellent introduction to git guide that you should read.
By the end of this walkthrough you will:
- Clone this repository
- Commit a change locally
- Open a PR for that change
- Merge PR
Directories in git are called repositories. There is a repository for each Robotics crew. To create a new repository please contact one of the org admins.
Follow these directions to clone either using the command line or GitHub Desktop.
Once you have the repository locally, create a new branch
git checkout -b branch_name
Check that your branch was created and you are now on that branch
git branch
Create a new file in the git_onboarding directory.
Make at least two commits to this file.
git add -A
git status
git commit -m "First commit message"
...
git add -A
git status
git commit -m "Second commit message"
Push your local branch to GitHub
git push -u origin branch_name
Go to GitHub and confirm you branch has been pushed with those commits.
Open a PR. Tag me scottshepard as a reviewer (and whomever else you'd like).
Make sure to include a good title and description.
Your tagged reviewer should now review your PR. If they ask for changes,
make or discuss them. Code review is the first line of defense against
buggy code. For big changes, the reviewer should download the code
locally (with git checkout branch_name) and test it themselves.
Once a reviewer has approved the PR, use the squash-and-merge feature.
- Commit early, commit often
- Commits should be atomic
- Never commit directly to master
- Each feature gets its own branch
- Approval on PR before merge
Here is a non-exhastive list of common git commands I use every day.
git status
git add file_name
git add -A
git commit -m "Some commit message"
git branch
git branch -vv
git checkout branch_name
git checkout -b new_branch_name
git pull
git push
git push -u origin branch_name