Git Tips
Enable Javascript to display Table of Contents.
Git Shallow Clones
Saving disk space and speeding up git-clone with shallow clones.
git clone --depth=1 --branch feature/hugo git@github.hugo OUTPUT_DIR
The shallow clone can be converted to a "full clone" by: git fetch --unshallow
Git Aliases
Showing graph (list graph = lg) on command line:
git config --global alias.lg \
"log --graph --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ar)%Creset'"
Cleaning Repository
Removing all changes and untracked files:
$ git checkout .
$ git clean -fd
Mirroring a Repository
$ git clone --bare git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
Cloning into bare repository 'linux-stable.git'...
remote: Counting objects: 7958050, done.
remote: Compressing objects: 100% (142578/142578), done.
remote: Total 7958050 (delta 826748), reused 970167 (delta 826088)
Receiving objects: 100% (7958050/7958050), 1.43 GiB | 19.90 MiB/s, done.
Resolving deltas: 100% (6706483/6706483), done.
$ cd linux-stable.git/
$ git push --mirror git@intranet.lan.work-microwave.de:satcom/linux-stable-mirror.git
Enumerating objects: 7958050, done.
Counting objects: 100% (7958050/7958050), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1202450/1202450), done.
...
$
Source: github.com