Created
April 20, 2025 18:47
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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