Files
git.taskfile.build/bin/add-git-merge
T

22 lines
465 B
Bash
Executable File

#!/bin/bash
add-git-merge() {
if [[ -z "$1" ]]; then
echo '$1/remote is empty.' >&2
exit 1
fi
if [[ -z "$2" ]]; then
echo '$2/merge is empty.' >&2
exit 1
fi
if [[ -z "$3" ]]; then
echo '$3/path is empty.' >&2
exit 1
fi
local remote_name="$1"
local merge_ref="$2"
local submodule_path="$3"
git config -f .gitmodules --add merge."$submodule_path"."$remote_name" "$merge_ref"
}