Git

From Linuxintro
Revision as of 10:44, 11 February 2012 by imported>ThorstenStaerk (→‎git vs svn translation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Git is a revision control system that allows you to clone complete software repositories among developers.

Get git

Here is an example how to download and install git. Find out your distribution and proceed accordingly:

SLES 11

Get the SLE SDK media, add it as repository, install git using

yast -i git

SLES 10

This example downloads version 1.7.6 of git and must be executed as root user under a default installation of SLES 10:

  • Download git
wget http://www.kernel.org/pub/software/scm/git/git-1.7.6.tar.gz
  • if this does not work, you may have to set your proxy and redo it like this
export http_proxy=proxy.company.com:8080
wget http://www.kernel.org/pub/software/scm/git/git-1.7.6.tar.gz
  • unpack it
tar xvzf git-1.7.6.tar.gz
yast -i zlib-devel python-devel
cd git-1.7.6/
./configure && make -j8 && make install
  • test it by calling
# git version
git version 1.7.6

How to ...

... get a past version

repository # git reset  c3c9e4d97f0668235a5b
Unstaged changes after reset:
M       README

git vs svn translation

svn git purpose
svn co git clone get the software
svn co branch git checkout branch get a special branch of a software. Remark: This downloads additional code in the case of SVN, but not in the case of GIT.
svn up git pull update to the latest version
svn revert git checkout . revert the changes you have done
svn co -r commit git reset commit get the code as it was at a certain commit. Remark: This downloads additional code in the case of SVN, but not in the case of GIT.

Uploading

# git commit -am "bump year"
[master 49af19e] bump year
 Committer: root <root@linux-reif.site>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

If the identity used for this commit is wrong, you can fix it with:

    git commit --amend --author='Your Name <you@example.com>'