File: git-track

package info (click to toggle)
hxtools 20221119-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,760 kB
  • sloc: ansic: 5,114; perl: 3,612; cpp: 2,727; sh: 1,622; makefile: 156
file content (16 lines) | stat: -rwxr-xr-x 415 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
# SPDX-License-Identifier: MIT
#
#	written up by Jan Engelhardt, 2008

current_branch=$(pcregrep -o '(?<=^ref: refs/heads/).+$' .git/HEAD);
if [[ -z "$current_branch" ]]; then
	echo You do not seem to be on a branch >&2;
	exit 1;
fi;

remote_name="${1%/*}";
remote_branch="${1#*/}";

git config "branch.$current_branch.remote" "$remote_name";
git config "branch.$current_branch.merge" "$remote_branch";