by: otto sipe
github: @ottosipe
email: [email protected]
- git works by incrementally adding new changes to a repository
- as you make changes you run
git add .
to add the changes in the current directory orgit add filname
- once you've added files you can run
git commit -m "your description of changes here"
to make a commit - when you've made a commit (or multiple commits) you can run
git push
to send them to the main repo - if changes have been made on a different repo run
git pull
to pull those changes
in ~/.git
folder on CAEN: git init --bare eecs280/proj1
from CAEN home: git clone ~/.git/eecs280/proj1/
or from remote: git clone [email protected]:~/.git/eecs280/proj1
first push use: git push origin master
- login To CAEN
ssh [email protected]
- create a .git folder in your home directory
mkdir .git; cd .git
- create a project repo (PROTIP: use folders for seperate classes)
git init --bare eecs280/proj1
- this command makes a folder called
eecs280
and a repository calledproj1
- this command makes a folder called
- go back to your home directory.
git clone ~/.git/eecs280/proj1/
- here we are making a copy of a repo to work use on CAEN (you can clone anywhere)
git
will most likely warn you that you've cloned an empty repo
- close CAEN and go back to your local machine. (optional if you only work on CAEN)
- make sure you have git installed
git --version
will give you a version number if you do- if you don't, go here
- clone your new repo to your local machine in a sensible directory
git clone [email protected]:~/.git/eecs280/proj1
- open the new folder and add your project files (or some blank test file)
- type
git commit -am "initial commit"
to commit your changes - then type
git push origin master
to send them to the server- you'll only have to type
origin master
once to let your machine know to create themaster
branch on the remote repo
- you'll only have to type
- log back into CAEN and go to your regular project files (not the ones in
.git
) usegit pull
to pull the changes you made on your local machine.- it is important to note that you have to
pull
andpush
on your own even if your on CAEN. when you push to CAEN you're pushing to the hidden remote repo in.git/
not to your regular file
- it is important to note that you have to
one of the best reasons to use git
is for the ability to create branches of your code and revert to old versions if you make a mistake - more on this later! (or serach "git tutorial" on google)
repo
orrepository
: wheregit
stores your files, really just a folder.git clone
: the process of copying a repo, locally or to a different machinegit add
: add changes to the stage of next commitgit commit
: add changes to your project. each snapshot is a called acommit
git commit -am "[message]"
: shorthand to add all changes and commit with a messagegit pull
: pull changes from a repo (used after you've runclone
)git push
: push changes to a repo