Git


Git is a powerful program that you must learn to use to help you mange your code.

Configuring Git


% git config --global user.name "John Doe"
% git config --global user.email johndoe@example.com
% git config --global push.default simple
% git config --global color.ui true

If you're using OS X or Linux:

% git config --global core.autocrlf input

If you're using Windows:

% git config --global core.autocrlf true

Checking the Git Configuration


% git config -l
user.name=Glenn Downing
user.email=downing@cs.utexas.edu
push.default=simple
color.ui=true
core.autocrlf=input

Creating a Repo and Connecting it to GitHub


% touch README
% git init
% git add README
% git commit -m 'first commit'
% git remote add origin git@github.com:gpdowning/cs373.git
% git push -u origin master

Cloning a Repo from GitHub


% git clone git@github.com:gpdowning/cs373.git cs373

will clone all of the examples, projects, and quizzes into a directory of yours, named cs373, and

% git clone git@github.com:cs373-spring-2014/collatz-tests.git collatz-tests

will clone all of the Collatz tests into a directory of yours, named collatz_tests.

Adding to a Repo


% git add Foo.py
% git add Bar.py
% git commit -m "another commit"
% git push

Syncing with a Repo


% git pull
Already up-to-date.

Checking the status of a Repo


% git status
# On branch master
nothing to commit, working directory clean