Git Cheat-Sheet

by on

This article contains a few useful git commands.

Gui tools

Open the built-in graphical tool for commits (requires tk):

git gui

Start a local webserver to browse the repository, open in chromium: (Requires lighttpd)

git instaweb -b chromium

Local repository

Create a new repository in the current directory:

git init

Add a new file to the repository:

git add <file>

Commit all pending changes:

git commit -am <message>

Remotes

View all remotes linked to from this repository:

git remote

Add a new remote

git remote add <name> <url>

Remove a remote

git remote rm <name>

Push local changes to a remote

git push <remote>

Push local tags to a remote

git push --tags <remote>

Pull changes from a remote

git pull <remote>

Tags

Create a signed tag (Requires a PGP key)

git tag -s <name>

Verify a signed tag

git tag -v <name>

Branches

Remove a remote branch

git push <remote> :<branch>