Resources‎ > ‎

Git


Setting up your repository

For this course, we will be using GitHub to distribute and submit assignments. The fork-clone approach we use allows you to always have the latest version of an assignment, and makes it possible for NINJAs to easily find your work.


Prerequisites


The following assumes that you
  • have a GitHub account
  • are familiar with basic git operations like cloning, committing, pushing and pulling
If that's not true (or you need a refresher), check out the references below, starting with Chapter 1 and Chapter 2 of Allen's AmGit book. If you still have questions, please post them on Piazza.

Fork the CompArch repository

  1. Sign in to GitHub
  2. Go to the repository for the assignment you're working on, e.g.: https://github.com/CompArchFA17/HW1 
  3. Fork the repo by clicking the button in the upper right
  4. You should now be at the page for your forked copy of the repo. Make a note of the clone URL (box on the right).

Clone your fork to your local machine


Choose a location to clone the repo. We recommend something close to the root and without spaces (to prevent potential issues with poorly written software).

$ git clone https://github.com/yourgithubname/HW1.git    # From step 4 above
$ cd HW1

Create a link back to the main course repository


This will allow you to pull in updates to assignments (if any) as they are released.

$ git remote add upstream https://github.com/CompArchFA17/HW1.git
$ git pull upstream master

That's it, you're ready to get to work!


Normal workflow


Grab any updates

Pull the latest copy of the assignment materials from the course repository

$ git pull upstream master

Work on the assignment

Add/commit files as necessary as you go.

Submit your work

Work is submitted by pushing to GitHub

$ git push origin master

You can/should push all along as you work, but be doubly sure to push your final commit before the due date. NINJAs can't see your work if it's only in your local repository on your laptop! If you're not sure if you've done it successfully, check out the GitHub website and make sure your latest work is there. 

Working with gitignore

In general, you want to commit your source files and test benches (.v), scripts (Makefile), and results documents to GitHub. Unfortunately simulators (and other tools) can create a variety of working files and folders, which can be quite large in size and clutter up your repository.


One good approach to preventing these from being committed is to tell git to ignore them by adding a .gitignore file to your repository.


GitHub provides a variety of starter gitignore files. Xilinx also provides an example gitignore for Vivado.


References

Places to turn for help
Comments