git
is one of the most common and popular versioning systems in the world. You are already familiar with it from ECE281, so this should be simple. There are only a couple of commands for you to learn (and you can only use these)
Only use these commands:
clone
: make a copy of a repository located in the internet/cloudpull
: update your local repo with any changes in the repo in the cloud. This is necessary when working in a group or making changes via web browser to bitbucket.status
: are there untracked changes in your local repo?add
: gather up files in your local repo that have changed and you want to save those changescommit
: after files have been added, bundle of them together with a description of the changespush
: send a commit of changes to the repo in the cloudAlthough the Codecademy.com lesson showed you more, in this case, more is not better!
.gitignore
CCS is a standard horrible IDE that we use. Unfortunately it generates a lot of files we don’t care about and we don’t want that junk in our repo.
# Ignore everything
*
# ok, now we need to bring identify what we want to track
# let's start with:
# - assembly files
# - C files
# - Markdown files and jpg/png images
!.gitignore
!lab*/
!*/*.c
!*/*.h
!*/*.asm
!*.md
!*.jpg
!*.png
!*/
Further documentation on git
is available here.
The layout of your repo should be:
readme.md
main.asm
or main.c
main.asm
or main.c
main.asm
or main.c
main.asm
or main.c
readme.md
should contain the following information:
clone
this to our laptops
https
, 10th CS blocks ssh
(port 22)gitbash
git config --global user.name "First Last"
git config --global user.email first.last@usafa.edu
git config credential.helper wincred
git clone https://walchko@bitbucket.org/walchko/382-walchko.git
.gitignore
like the one abovegit status
.gitignore
should be listed theregit add .gitignore
*.c
to add all C files, *.py
to add all python files (not this class), etc.git commit -m "first commit"
git log
git status
If you create, add or modify a file from the browser (remember you are modifying the repo in the cloud, not on your computer), so you should always do git pull
first to update your local repo on your laptop. If you don’t and you make changes to the same file on your computer, git doesn’t know what changes you really want. It just knows two files are different and the cloud and your computer repos are out of sync!
This is also a good reason for branching, which we won’t do in the class. But, if you have many different people working on the same code, you will create different branches so things can be merged back together cleanly. I would keep this in mind for capstone, but no one ever uses it primarily because our IT infrastructure is crap because of 10th CS.
Honestly, be careful with Google. If you wildly throw git
commands at your system you will break it. If your buddy tells you to do something you don’t understand, you could break your repo. If you break your repo, then it is up to you to fix it. Everything you need for the class is above, you should never need to come to an instructor because your repo is broken. On the positive side, if you break it, you will learn a lot about git
trying to fix it!
ice1
and make sure to select assembly only.