DEV Community

Discussion on: Git single command executor

Collapse
 
tominoff profile image
Tominov Sergey • Edited

giq p is not consistent. If you pass 3 args - it will add all files and push with message, but if less - it will just push.
Also, as Duncan says - why we need install node for this kind of things? I believe shell is better for this kind of scripts.

I suggest you take attention on shell aliases.
For example - alias gad="git add", alias gcm="git commit -m" and so on.
To create multicommand tasks you can simply create shell function:

__git-add-commit-push() {
  if [ $ARGC -gt 1 ]; then
    git add . && git commit -m "${1}" && git push origin ${2}
  else
    echo "Wrong usage, please pass <message> <branch>"
    return 1
  fi
}

alias gacp="__git-add-commit-push" 
Enter fullscreen mode Exit fullscreen mode
Collapse
 
udithaishan profile image
Uditha Ishan

I got curious about publishing an npm package. So that's why I used node. I'm happy to look at your recommendations.