Use the space bar or right arrow for next slide,
left arrow to back up. Use 'a' key to toggle between single
page and slide modes.
Git is a distributed configuration managment systems. It was developed by the Linux kernel group and is used by a number of other open-source development projects. These notes are a "cookbook" on how to use git on the team project in our course, for the International Etruscan Sigla Project (IESP) software system.
The workflow here is based on Vincent Driessen's article A successful Git branching model. (See also local files .pptx slides, .pdf of slides, and .pdf summary chart.) The main difference are:
Jobs for me do do:
I think I have set up about everything that we will need on the server. (It is a pretty complicated set of jobs, though.) I have tested all of the steps currently described in this file, and they worked, so long as there were no merge or push conflicts. I still would like to do the following:
/home/www/vhosts/iesp.cs.fsu.edu
when updates are pushed into /home/git/iesp.git
/home/git/iesp.git
to
send e-mails on new commits. I tried doing this, but it does not yet
seem to be working.Do this once on each computer that you will be using as a workstation.
Set up ssl to use use
public key authentication between your workstation and
the project server sis.cs.fsu.edu
.
See the separate notes on how to do this.
If you skip this step you will be prompted for you HTTP password (not you Unix login password) at many points.
Add to the file that sets your local environment variables (in ~/.profile
on Linux systems)
export GIT_SSL_NO_VERIFY=true
If you do not set either this or http.sslVerify
as explained below, then when you try to clone from the
repository using HTTPS you will see a message like the following:
error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed ...
Set up your global git configuration variables as follows, substituting your name, e-mail address, and favorite editor for mine.
$git config --global user.name "Ted Baker"
$git config --global user.email "baker@cs.fsu.edu"
$git config --global core.editor emacs
$git config --global http.sslVerify false
You should see the results in your local
file ~/.gitconfig
, as follows:
$ cat ~/.gitconfig
[user]
name = Ted Baker
email = baker@cs.fsu.edu
[core]
editor = emacs
See git-config man page for the complete list of configuration options.
Do the following
once, replacing baker
by your own username. For
the password, give the HTTP password assigned to you
for use with trac
etc. in this course. (Not your Unix login password.)
Create the new repository, by executing the following in the directory that you want as parent of your repository.
$ git clone ssh://baker@sis.cs.fsu.edu/home/git/iesp.git
Initialized empty Git repository in /home/baker/swe2/tmp/tmp/.git/
remote: Counting objects: 2089, done.
remote: Compressing objects: 100% (851/851), done.
remote: Total 2089 (delta 1203), reused 2067 (delta 1194)
Receiving objects: 100% (2089/2089), 5.58 MiB, done.
Resolving deltas: 100% (1203/1203), done.
You should now have a local directory iesp
that contains a clone of the repository /home/git/iesp.git
at
sis.cs.fsu.edu
.
You should see something like the following for the status
and current branches of the repository.
$cd iesp
$git status
# On branch develop nothing to commit (working directory clean) $git branch -a
* develop remotes/origin/HEAD -> origin/empty remotes/origin/develop remotes/origin/master
The branch branch "master"
is reserved for major releases. The only branch you should touch
is "develop", and you should only do that remotely, using git http-push
according to the directions further below.
I have written a bash shell-script to do the above, called iespclone. You may find it convenient to
copy this into your ~/bin
directory, chmod 750
iesplcone
, and make sure ~/bin
is in your bash
search path (PATH
). It assumes the name "iesp" for
your local repository, but you can change that by editing the script.
To develop a new feature, do the following.
I have created a bash shell script hack to automate
these steps,
based on git-o-mator by
Jusin Pease.
It seems to work with ssh, but will need further adaptation
to use git http-push
It assumes you are working on branch "mybranch", but you can change that by
providing your branch name as parameter to hack on
.
Optionally, in order to visualize what you are doing locally,
run gitk
in the background while you are working.
$ gitk&
Create yourself a new branch for the feature, using "develop" as the starting point.
$git checkout -b mybranch develop
$Branch mybranch set up to track remote branch develop from origin. Switched to a new branch 'mybranch'
Edit and test for a while, in your local working directory.
In this example, the only change I made was to edit the file
NOTES
.
$git add .
$git status
# On branch mybranch # Changes to be committed: # (use "git reset HEAD..." to unstage) # modified: NOTES # $ git commit -m "Added to NOTES file."
[mybranch 6c625b] Added to NOTES file. 1 files changed, 6 insertions(+), 0 deletions(-)
Then fetch and rebase your local branch, to roll in any changes that other team members have posted posted recently.
$git fetch
$git rebase origin/develop
Current branch mybranch is up to date.
In this case, there were no changes to the remote branch.
Repeat steps 2-3 until you have something that is tested well enough to share with the rest of the team.
$git checkout origin/develop
Note: moving to 'origin/develop' which isn't a local branch If you want to create a new branch from this checkout, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -bHEAD is now at 44795ee... Merge branch 'local_fixes' into develop $ git merge --no-ff mybranch
Updating 44795ee..98067bf Fast forward parameters_443.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) delete mode 120000 parameters_443.py
If you are lucky, the merge will succeed without conflicts. If you are not, you should abort the merge and go back to step 3 (sync).
When the merge succeeds, push your changes to the shared repository
$git http-push https://baker@sis.cs.fsu.edu/iesp.git develop
Password:your git HTTPS password
Fetching remote heads... refs/ refs/heads/ refs/tags/ refs/remotes/ refs/remotes/origin/ updating 'refs/heads/develop' from 44795ee28fb684e5bdb2cd68ac24e280fe7a2e61 to 98067bfbedb0f191f284dbdd565f429682c6ebf1 sending 2 objects done Updating remote server info
$ git branch -d mybranch
Deleted branch mybranch (was 98067bf).
merge
and push
steps,
if someone else has been modifying the same file(s).