The Header: Enauts Thinking!
created:Sat 15 Feb 2014
edited:Thu 01 Aug 2019
translations: english no translations

Git – a small user guide

Git is a nice tool to manage one's source code as well as tons of other files. There are hundreds of git HOWTOs already out there but this one is mine. I just setup my git as I'm used to it.


The installation with fedora:

$ sudo yum install git gitg git-svn


My favorite setup is basically the default. With added colors and of course setting the email and name:

$ git config --global "John Doe"
$ git config --global
$ git config --global color.ui true

Basic Git workflow

Checking out in git is rather cloning the whole repository:

$ git clone git@server.domain:git-repos

Once checked out the following three actions are most important:

  1. modify files
  2. commit files
  3. push to server

Modifying the files in the repository until some atomic commit is ready. Once a commit is ready, the next commit is prepared. This is a little different from other version control systems but it is very effective. To create a commit the changes that should be in that commit have to be added to the so called staging area. This is done by:

# to add a file as a whole
$ git add filename
# to get an interactive change adding mode that
# iterates though the changes made
$ git add --patch

Once the changes that will be in the next commit are staged recheck this with:

$ git status  #display the status of the repository

Committing the changes is then done with:

$ git commit

Write a meaningful commit message into the repository so that everybody understands what you changed. Then save and quit the editor.

The next step pushes the locally committed changes to the remote server do so by:

$ git push

If the server complains that you do not have the most recent version, then update your local git repository. It is wise to always update right before one starts to work on the repositories to avoid unnecessary conflicts. Do so with:

$ git pull

Git-SVN workflow

Unfortunately svn is still widely used but with git-svn a lot of its trouble can be eased. There are some of the most important commands:

#checkout a files and history to a git repository.
$ git svn clone svn://server.domain/repository-path
# for updating if there is a new version in the remote repository.
$ git svn rebase
# to send the local commits to the server.
$ git svn dcommit


Add a new comment

Note that all comments are moderated - so your post will not appear till I find time to accept it.

The comments do use markup syntax.

Confirm Email: leave the above line empty!