This page is divided into the following sections:
git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto
~/
.gitconfigcd project-directory git init
git add .
git commit
The following cron jobs have been defined:
ferdinand.allmech.tuwien.ac.at:/home/tng/tng/SLangTNG
git clone ferdinand.allmech.tuwien.ac.at:/home/tng/tng/SLangTNG myrepo
You can commit to your own repo as long as you wish. When being finished the main user (TNG master) must pull the changes from your repository:
cd /home/tng/tng/SLangTNG git pull $HOME_OF_YOU$/myrepo master
One can check what the otehr user did without trying to merge:
git fetch /home/bob/myrepo master git log -p HEAD..FETCH_HEAD
A visualization can be done using gitk or qgtk
gitk HEAD..FETCH_HEAD
git remote add bob /home/bob/myrepo
git remote add bob /home/bob/myrepo
The changes of bob are stored in an own branch ("bob/master") which can be reviewed. Let show the changes of bob
git log -p master..bob/master
git merge bob/master
Later, Bob can update his repo with the last changes of TNG master doing
git pull
The workflow is:
user commits changes to temp. branches | | user pulls V master repo -----------------------> user repo with changes | ^ | | reviews changes and | user merges possible conflicts and | merges user branch | continues his work | | | V master repo <----------------------- user repo master fetches with changes
In order to clone the shared repository, type
git clone user@ferdinand.allmech.tuwien.ac.at:/home/tng/tng/SLangTNG_shared.git my-project cd my-project
The workflow is:
user commits changes to temp. branches | | shared pulls user pulls V master repo ---------------------> shared repo --------------------> user repo <--------------------- ^ | master fetches | | | | user merges possible conflicts and | | continues to work | | | V +------------------------------- user repo with user pushes committed changes
ferdinand.allmech.tuwien.ac.at:/home/tng/tng/SLangTNG
mkdir /home/tng/tng/SLangTNG_shared.git cd /home/tng/tng/SLangTNG_shared.git git --bare init --shared git --bare fetch /home/tng/tng/SLangTNG master:master
Put all the committers in the same group, and make the repository writable by that group:
chgrp -R tng /home/tng/tng/SLangTNG_shared.git
Note:
ferdinand.allmech.tuwien.ac.at
:/home/tng/tng/SLangTNG_shared.gitgit clone --bare SLangTNG SLangTNG_public.git touch /home/tng/tng/SLangTNG_public.git/git-daemon-export-ok
Users may fetch from this repo, but may not be able to push changes to it. The idea is that any developer has two repositories, a private and a public one. Then, the workflow is
you push your personal repo ------------------> your public repo ^ | | | | you pull | they pull | | | | | they push V their public repo <------------------- their repo
In order to clone the public repository, type
git clone user@ferdinand.allmech.tuwien.ac.at:/home/tng/tng/SLangTNG_public.git my-project cd my-project
git log
git log -p
git log --stat --summary
The equivalent of cvs update which merges in any work that others might have done since the clone operation is:
git pull origin
The pull command knows where to get updates from because of certain configuration variables that were set by the first git-clone command.
You can update the shared repository with your changes by first committing your changes (see section "editing"), and then using the git-push command:
git push origin master
As long as the shared repository does not have any branches other than master, the parameter "master" can be neglected (else ALL other branches will be pushed/pulled as well)
git add file1 file2
git diff --cached
git diff
A brief summary is given by
git status
Commit all changes which have been passed to the index:
git commit
git commit -a
push
and pull
commands.
A notice on log messages: 1st line: max. 50 characters - short description. the other lines: long description. You can also pass log messages as command line paremeter via git
commit
-m
"message"
rm filename git checkout filename
In order to set up your environment to commit using CVS, follow these steps:
cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co \<HEAD_name>
export CVSROOT=:ext:user@server:/var/git/project.git
export CVS_SERVER="git cvsserver"
-d
<dir_name>
. For example, this checks out master branch to the project-master directory: cvs co -d project-master master