dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 1d08fbda30a7c9ae985275e4dd1b678114afd87d
parent f393d2cee73d0770fd8bbed2b265be3894fcee50
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 22 Apr 2020 10:21:51 +0200

Offer to push to remote after creating git repository

Diffstat:
M.profile | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/.profile b/.profile @@ -68,11 +68,19 @@ create-repo() { fi if ssh "${user}@${host}" "./create-repo.sh ${1}"; then if [ -f .git/config ]; then - printf "add as remote origin? [Y/n] " + printf 'add as remote origin? [Y/n] ' read case "$REPLY" in N|n) return 0;; - *) git remote add origin "${user}@${host}:${1}";; + *) + git remote add origin "${user}@${host}:${1}" + b="$(git branch | awk '{print $2}')" + printf 'push to remote branch "%s"? [Y/n] ' "$b" + read + case "$REPLY" in + N|n) return 0;; + *) git push --set-upstream origin "$b";; + esac;; esac fi fi