Git Stuff

Links

Commands

Reset

git reset --hard

Clean

git clean -xdf

Create bare git repo

mkdir test_repo.git
cd test_repo.git
git --bare init

Clone including submodules

git clone --recursive <url>

Clone from subversion

git svn clone <url>

Force a push

git push origin master --force

Commit with a comment

git commit -m 'changes to hello file'

Delete all tags in the local repository

git tag -d `git tag | grep -E '.'`

Delete all tags on remote

git ls-remote --tags origin | awk '/^(.*)(\s+)(.*[a-zA-Z0-9])$/ {print ":" $2}' | xargs git push origin

BASH

Script for creating a bare git repo

#!/bin/sh
if [ -z "$1" ]; then 
    echo usage: $0 git-repo-name
    exit
fi
REPONAME=$1
echo Creating bare git repo $REPONAME.git
mkdir $REPONAME.git
cd $REPONAME.git
git --bare init

You can execute bash scripts remotely via ssh:

ssh <host> 'bash -s' < <name-of-the-script>

This only works well by using ssh-keys for authentication.

05:19:12 · Hyrtwol, Version 1.1.0.45 · Repertoire, Version 1.1.51.82 · View markdown source