kesto.de Cheatsheets

git

Initialize local repository

git init --bare example.git

Use local repository

git clone ~/path/to/example.git
cd example
echo "Hello world!" > README
git add README
git commit .
git push ~/path/to/example.git master

Configure current working copy

git config user.name "John Doe"
git config user.email john.doe@example.org

Clone from bare repository via SSH

git clone user@example.org:repositories/example.git

Clone from bare repository using local file system

git clone ~/path/to/example.git

Create bare repository from working copy

git clone --bare -l example example.git

Remove from index

git rm -r --cached .
git add .

Shallow cloning (get only state the latest commit)

git clone --depth 1 https://github.com/user/repo.git

Shallow cloning (get only state of the latest commit) for specific tag/branch

git clone --depth 1 --branch example-tag https://github.com/user/repo.git