Zerocat Label  v0.1.7
General Documentation for the Zerocat Label.
Zerocat Git Usage

Main Page | Related Pages | List of Files


Configuration Template

To ease collaboration, we would like to suggest the follwing settings for your Git Configuration. You might place them in the .git/config file of a project’s root folder, or – as an alternative – in your global Git Configuration File ~/.gitconfig.

name = Your Name
email = <>
signingkey = <your-OpenPGP-key-ID>
gpgsign = true
# git log:
# l: log, g: --graph --color,
# c: --oneline, s: --pretty=short, f: --pretty=format,
# a: --all
lg = log --graph --color --decorate
lga = log --graph --color --decorate --all
lgc = log --graph --color --decorate --oneline
lgca = log --graph --color --decorate --oneline --all
lgs = log --graph --color --decorate --pretty=short
lgsa = log --graph --color --decorate --pretty=short --all
lgf = log --graph --color --decorate --pretty=format:'%C(auto) %h %d %G? %aN %s'
lgfa = log --graph --color --decorate --pretty=format:'%C(auto) %h %d %G? %aN %s' --all
# git diff:
check = diff --check
default = simple

The [alias] section now contains some aliases for git log, and commands like git lgca should help you to get a quick overview of the repository’s history. In case you need to verify authors, use git lgfa instead.

To see whether your changes would introduce misplaced white-space, run git check as an alias of git diff --check.

When using GPG-signed commits as suggested by gpgsign = true in section [commit], please check your ~/.gnupg/gpg-agent.conf to have a line available which specifies a pinentry program, i.e.:

pinentry-program /usr/bin/pinentry

Some Useful Invokes

They mostly come from reading the "Pro Git" book.

# get started with a repository
git init
git clone

# show changes
git diff
git diff --cached                     # same as `--staged`
git status
git status -uno
git status -s

# commit changes
git commit -am "<commit message>"     # fast commit of *all* changes
git add <file>
git add --patch
git commit -m "<commit message>"      # fast commit of *staged* changes
git commit --no-status
git commit --uno

# rename or delete files
git mv
git rm

# work with branches
git branch                            # list local branches, mark current one
git branch <a-new-branch>             # create a new local branch, but stay on current one
git checkout -b <a-new-branch>        # create *and* checkout a new local branch
git stash                             # push away current changes which might hinder you to checkout elsewhere
git stash pop                         # pop previously pushed changes

## set up new-branch to track remote new-branch
git checkout new-branch

## delete branch upstream
git push origin :my-obsolete-branch

## delete local copies of already deleted upstream branches
git fetch --prune                     # refers to all local copies of remotes

# show history of commits
git log
git log --pretty=format:"%h %an %s" --graph
git log --abbrev-commit --pretty=oneline --graph
git log --abbrev-commit --pretty=medium
git log -p -2
git log --follow <filename>

# git configuration
git config --list
git config --add format.pretty oneline
git remote -v
git difftool --tool-help

# show differences between commits/ branches/ tags/ etc.
# in detail...: git diff <from> <to>
git diff master documentation
# in short...: git diff --stat <from> <to>
git diff --stat <refspec> HEAD    # you can omit 'HEAD'

Roles and Responsibilities

  • Project Initiator and Maintainer...
    • performs the merges into master or asks contributors to do so
    • pushes branches as a call for contribution
  • Contributors...
    • announce their branch and its purpose in advance by mail
    • don't forget to delete their branches in origin when the merge is done
    • or explain shortly why the branch is kept

Workflow: Contributing via branching


git branch my-new-branch ; git checkout my-new-branch
git add new-file-in-branch
git commit
git push origin my-new-branch  # Announce this via email
git branch --set-upstream-to=origin/my-new-branch my-new-branch
git push origin --delete my-new-branch  # We are done with the branch, delete on server


git pull origin             # Now new remote branches are visible
git checkout my-new-branch  # Sets up tracking branch (git branch -vv)
git branch --delete my-new-branch  # We are done with the branch, delete locally

Project Maintainer:

git checkout master ; git merge my-new-branch


  • gitk (comes with git)

Beyond Git

Main Page | Related Pages | List of Files