diff options
author | Case Duckworth | 2023-06-08 21:24:06 -0500 |
---|---|---|
committer | Case Duckworth | 2023-06-08 21:24:06 -0500 |
commit | 044df1cff6928073ab94faafa9bff0c7aa43e709 (patch) | |
tree | b789f0d84c12f00dfadfa81e2ba6dfe75d10af2a | |
parent | Make hook executable and prompt to push (diff) | |
download | git-init-remote-main.tar.gz git-init-remote-main.zip |
Use current branch for push -u main
-rwxr-xr-x | git-init-remote | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/git-init-remote b/git-init-remote index 043a780..71b9dd4 100755 --- a/git-init-remote +++ b/git-init-remote | |||
@@ -58,13 +58,14 @@ ssh "$GITREMOTE" chmod +x "$remote/hooks/post-update" | |||
58 | echo "git remote add origin \"$GITREMOTE:$remote\"" | 58 | echo "git remote add origin \"$GITREMOTE:$remote\"" |
59 | git remote add origin "$GITREMOTE:$remote" | 59 | git remote add origin "$GITREMOTE:$remote" |
60 | 60 | ||
61 | echo -n "Push to remote?" | 61 | echo -n "Push to remote? " |
62 | read | 62 | read |
63 | 63 | ||
64 | case "$REPLY" in | 64 | case "$REPLY" in |
65 | y*|Y*|'') | 65 | y*|Y*|'') |
66 | echo git push -u origin main | 66 | branch="$(git branch --show-current)" |
67 | git push -u origin main | 67 | echo git push -u origin "$branch" |
68 | git push -u origin "$branch" | ||
68 | ;; | 69 | ;; |
69 | *) ;; | 70 | *) ;; |
70 | esac | 71 | esac |