Skip to content

Instantly share code, notes, and snippets.

@ahmedfaragmostafa
Created March 29, 2017 07:09
Show Gist options
  • Select an option

  • Save ahmedfaragmostafa/ed0ac1e9a9d6d486c526c5b2f1589f19 to your computer and use it in GitHub Desktop.

Select an option

Save ahmedfaragmostafa/ed0ac1e9a9d6d486c526c5b2f1589f19 to your computer and use it in GitHub Desktop.

Revisions

  1. ahmedfaragmostafa created this gist Mar 29, 2017.
    16 changes: 16 additions & 0 deletions smartCommit.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    ##!/usr/bin/env bash

    smartCommit(){
    currentBranchName=$(git symbolic-ref HEAD | cut -d'/' -f3)

    echo -n "are you want to push with message (y/n)? "
    read userOption
    if echo "$userOption" | grep -iq "^y" ;then
    read msg
    echo "$currentBranchName $msg"
    git commit -m "$currentBranchName $msg"
    else
    echo "$currentBranchName fixes"
    git commit -m "$currentBranchName fixes"
    fi
    }