summary refs log tree commit diff
path: root/git-set-head
blob: a68f7186b7d9c669006c5307c1c89870583f13c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env bash
#
# usage:
# git set-head <branch>
# 
# example:
# 	$ git set-head main
#	modifies the current git repos origin config so that cgit knows
#	what branch is the main and can correctly set the time since it
#	was last modified

HOST=gen@quartet
CGIT_ROOT=git

if [ $# -eq 0 ]; then
    echo "requires an arg"
    exit 1
fi

# [cgit]
#        defbranch = main

remote=$(git remote get-url --push origin | cut -d ':' -f 2)
ssh $HOST echo -e "\n\n[cgit]\n\tdefbranch = $1" \>\> "$remote/config"