From 41576f288003db261a6bdfc2069a6e05e9938131 Mon Sep 17 00:00:00 2001 From: Joel Mathew Thomas <90510078+joelmathewthomas@users.noreply.github.com> Date: Thu, 13 Jun 2024 16:02:57 +0530 Subject: [PATCH] fixed typo in gp:bin --- .local/bin/gp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.local/bin/gp b/.local/bin/gp index 245c0c5..2f2664b 100755 --- a/.local/bin/gp +++ b/.local/bin/gp @@ -1,17 +1,28 @@ #!/bin/bash -# Check if argument is provided +# Check if at least one argument is provided if [ $# -eq 0 ]; then - echo "Usage: $0 " + echo "Usage: $0 [branch]" exit 1 fi # Add all changes +echo "Staging all changes" git add . # Commit with the provided argument +echo "Commiting all changes" commit_message="$1" git commit -m "$commit_message" -# Push changes to the master branch of the origin remote -git push -u origin master +# Check if a branch name is provided, otherwise use 'master' +if [ -z "$2" ]; then + echo "No branch was specified, using default master" + branch="master" +else + branch="$2" +fi + +# Push changes to the specified branch of the origin remote +echo "Pushing to $branch" +git push -u origin "$branch"