A distributed version control system. These are the main concepts of git:
git pull
is the same as a git fetch
followed by a git merge
.
Before you do anything do the following:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
$ git config --global color.ui true
To access gitlab you will need to setup a ssh-key for your account.
$ ssh-keygen -t rsa -C "<your mail or any other meaningful title>"
(Linux: ~/.ssh/id_rsa.pub, Windows:
$ cat ~/.ssh/id_rsa.pub % This will print the content on the console
$ ssh git@sully.informatik.uni-stuttgart.de
<YourGroupNumber>
repository into the current folder creating a local copy$ git clone git@sully.informatik.uni-stuttgart.de:ai_lecture/group_<YourGroupNumber>.git
$ git pull
$ git push
$ git status
$ git add .
Your commit message
$ git commit -m "Your commit message"
$ git rm [-r] <somefile>
This demo shows the workflow for doing the exercises.
1a) Frist you need to clone your repository to get a local repository, this is only required once.
stefan@arbeitstier ~/gki $ git clone git@sully.informatik.uni-stuttgart.de:ai_lecture/group_0.git
Cloning into 'group_0'...
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 9 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (9/9), done.
Checking connectivity... done.
stefan@arbeitstier ~/gki $ cd group_0
1b) If you all ready have cloned it, remember to update your local repository by pull from the remote. This will also download new exercises, after they have been published.
stefan@arbeitstier ~/gki/group_0 (master) $ git pull % get changes from the remote
Solve the given exercises, in this demo "e00_firststeps" is solved.
In the following are the steps required to test and upload your solution.
stefan@arbeitstier ~/gki/group_0 (master) $ cd e00_firststeps % testing works only in the exercise folder
stefan@arbeitstier ~/gki/group_0/e00_firststeps (master) $ run_tests.sh % Testing my solution
....
----------------------------------------------------------------------
Ran 4 tests in 0.000s
OK
stefan@arbeitstier ~/gki/group_0/e00_firststeps (master) $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: e00_firststeps.py
no changes added to commit (use "git add" and/or "git commit -a")
stefan@arbeitstier ~/gki/group_0/e00_firststeps (master) $ git add e00_firststeps.py
stefan@arbeitstier ~/gki/group_0/e00_firststeps (master) $ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: e00_firststeps.py
stefan@arbeitstier ~/gki/group_0/e00_firststeps (master) $ git commit -m "Solved e00"
[master a635953] Solved e00
1 file changed, 4 insertions(+), 4 deletions(-)
stefan@arbeitstier ~/gki/group_0/e00_firststeps (master) $ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
stefan@arbeitstier ~/gki/group_0/e00_firststeps (master) $ git push
To git@sully.informatik.uni-stuttgart.de:ai_lecture/group_0.git
85c98ec..a635953 master -> master
This is the git demo form last year
stefan@arbeitstier ~ % cd tmp
stefan@arbeitstier ~/tmp % mkdir git_demo
stefan@arbeitstier ~/tmp % cd git_demo
stefan@arbeitstier ~/tmp/git_demo % git init
Initialized empty Git repository in /home/stefan/tmp/git_demo/.git/
stefan@arbeitstier ~/tmp/git_demo (git)-[master] % echo "Test" > README
stefan@arbeitstier ~/tmp/git_demo (git)-[master] % git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# README
nothing added to commit but untracked files present (use "git add" to track)
stefan@arbeitstier ~/tmp/git_demo (git)-[master] % git add README
stefan@arbeitstier ~/tmp/git_demo (git)-[master] % git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: README
#
stefan@arbeitstier ~/tmp/git_demo (git)-[master] % git commit
[master (root-commit) 615d9f7] Add README.
1 file changed, 1 insertion(+)
create mode 100644 README
stefan@arbeitstier ~/tmp/git_demo (git)-[master] % git status
# On branch master
nothing to commit (working directory clean)