Skip to content

Instantly share code, notes, and snippets.

@levchenkod
Created April 20, 2025 18:47
Show Gist options
  • Save levchenkod/239e9473f1f32847115a559656d575c4 to your computer and use it in GitHub Desktop.
Save levchenkod/239e9473f1f32847115a559656d575c4 to your computer and use it in GitHub Desktop.
`p` - terminal command to add all, commit and push to the current branch
function gitacp() {
if git diff --quiet && git diff --cached --quiet; then
echo "✅ No changes to commit. Exiting."
return 0
fi
if [ -z "$1" ]; then
echo "Usage: gitac \"commit message\""
return 1
fi
git add .
git commit -m "$1"
currentBranch=$(git rev-parse --abbrev-ref HEAD)
git push origin "$currentBranch"
}
alias p="gitac"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment