commit 19e639395cbd9e4914190b3d3f4a1678d1a9d221
parent d86802e864b39342cdecab6f0a22d2086ea4b9fe
Author: gearsix <gearsix@tuta.io>
Date: Wed, 9 Oct 2024 22:00:26 +0100
added git-init
Diffstat:
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
@@ -57,9 +57,7 @@ What I usually do is just put the scripts in a directory and add it to the `PATH
- *jiggle* - move the mouse 1px every minute - keep the screen awake.
-### Shell/Bash
-
-I make an effort to keep to **sh** when I can, for compatibility-sake.
+### POSIX shell (and bash)
**strings & numbers**
@@ -88,6 +86,7 @@ Scripts related to string parsing/manipulation
- *git-clone-bulk* - clone a list of git repositories.
- *git-pull-all* - pull all remote git branches from the current upstream.
- *git-pradd* - git diff $@, for each prompt y/n whether to git add it
+- *git-init* - initialize a git server repository (I use it for my own remote server)
- *gobuild* - build a go module in all available output formats, useful for releases.
- *preview-md* - convert a markdown file $1 to html, open if $2 == "-o" or "--open".
- Uses cmark by default, set conversion tool and default output destination in src.
diff --git a/src/posix/git-init.sh b/src/posix/git-init.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+# git-init will init a git repository (on a git server)
+# $1 should be the name of the repository
+
+if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+ echo "Usage: git-init REPO"
+ echo ""
+ echo "'git init' multiple repos in one call. REPO should be a list of the repository names."
+ echo "bash expansion is useful here: 'git-init github.com/user/{repo1,repo2}"
+ exit
+fi
+
+mkdir "$HOME/$1" && ln -s "$HOME/$1" "$HOME/$1.git" && git init --bare "$HOME/$1"