Skip to content

Instantly share code, notes, and snippets.

View Vhndaree's full-sized avatar
🎲
Rolling

Ram Kumar Bhandari Vhndaree

🎲
Rolling
  • Rewe Digital
  • Germany
  • 20:07 (UTC +01:00)
View GitHub Profile
@Vhndaree
Vhndaree / gcom.sh
Created June 28, 2023 10:01
Everytime you commit if you also add branch name as a commit prefix than you can use this as alias and using the alias with commit message will automatically prepend the branchname to your commit.
gcom() {
if [ -z "$1" ]; then
echo "Please provide a commit message."
else
branch_name=$(git symbolic-ref --short HEAD)
if [ $? -eq 0 ]; then
git commit -m "${branch_name}: $1"
else
echo "Not a git repository. You can create repo with git init"
fi