#!/bin/bash # # git-register.sh - helper app for setting the most common git user configs # Copyright (C) 2008 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. echo "Note: Simply pressing ENTER leaves a setting untouched. Enter '-' to" echo "remove a config variable or '.' to set it to an empty value." set_git_config() { if git config $1 > /dev/null; then read -p "$1 (`git config $1`): " value else read -p "$1: " value fi if [ "$value" = "-" ]; then git config --global --unset $1 elif [ "$value" = "." ]; then git config --global $1 "" elif [ "$value" != "" ]; then git config --global $1 "$value" fi } echo "-- Your full name and email address to be recorded in commits --" set_git_config user.name set_git_config user.email echo "-- Commands to be used to edit messages and paginate output --" set_git_config core.editor set_git_config core.pager