Skip to content

Instantly share code, notes, and snippets.

@ashavijit
Created October 10, 2022 06:43
Show Gist options
  • Select an option

  • Save ashavijit/2da1706b020d59c55722d01cb155141e to your computer and use it in GitHub Desktop.

Select an option

Save ashavijit/2da1706b020d59c55722d01cb155141e to your computer and use it in GitHub Desktop.
You Know I am too lazy to follow-up so called git-protocols so added a shell-script to push my code ... --->
#!/bin/bash
current_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git pull origin $current_branch
echo "=== pull changes from '$current_branch' branch ==="
msg="$1"
if [[ -z "${msg//}"]]
then
msg=$(date '+%Y-%m-%d %H:%M:%S')
fi
git add .
echo "====staged all git files"
git commit -m "$msg"
echo "====committed changes with message '$msg'"
git push origin $current_branch
echo "====pushed changes to '$current_branch' branch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment