Does git know who you are ? try the following in a terminal:
$ git config user.name
$ git config user.email
If there is no satisfactory answer, tell git who you are, so that it inserts the right author name into the commits (snapshots). Don't forget the quotes around your name.
$ git config --global user.name "Matthew Brett"
$ git config --global user.email matthew.brett@gmail.com
Check these have worked with:
$ git config user.name
$ git config user.email
Let's go ahead and create our first git repository, which will contain our versions of the spm functions:
Create a directory called "pna_code":
$ cd # change to your home directory
$ mkdir pna_code
Change into this directory:
$ cd pna_code
Execute the command "git init":
$ git init
Initialized empty Git repository in <home>/pna_code/.git/
Git now created a directory (called .git) in which it tracks the changes that you make to the project.
$ ls .git
Now, we are ready to start tracking our files and any changes we make to them.
If you wrote your own awesome spm_funcs.py then copy that file into this directory:
$ cp ~/pna/pna2015/day3/spm_funcs.py .
If you think that my version might be more awesome, copy that instead, but with the file name spm_funcs.py:
$ cp ~/pna/pna2015/day3/spm_funcs_solution.py spm_funcs.py
Next copy the test script into this directory:
$ cp ~/pna/pna2015/day3/test_spm_funcs.py .
This is our working tree:
$ ls
spm_funcs.py test_spm_funcs.py
Now we have a git repository, we can ask git to tell us about the status of the working tree:
$ git status
On branch master
Initial commit
Untracked files:
(use "git add <file>..." to include in what will be committed)
spm_funcs.py
test_spm_funcs.py
Git says that it is on a branch called 'master'. This is the default branch that git creates for us. Of course it doesn't have any commits (snaphots) yet.
There are two files in the working tree, but git doesn't know anything about these yet (they haven't gone into the staging area, or a commit == snapshot). Git calls these type of files "untracked".
Now let's add these files to the staging area, ready for a commit:
$ git add spm_funcs.py
$ git add test_spm_funcs.py
Now what does git status say?
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: spm_funcs.py
new file: test_spm_funcs.py
Now we have the files in the staging area, we are ready to make a commit.
$ git commit -m "First commit"
[master (root-commit) 5c1885f] First commit
2 files changed, 46 insertions(+)
create mode 100644 spm_funcs.py
create mode 100644 test_spm_funcs.py
Get our history so far:
$ git log
commit 3b749610ff5287f6de2a3b7d86e67d44129bbbc3
Author: Matthew Brett <matthew.brett@gmail.com>
Date: Wed Mar 11 19:16:35 2015 -0700
First commit