Created
February 5, 2023 12:03
-
-
Save sdkks/dc00e2a71b0a4988fe91cae051cd4909 to your computer and use it in GitHub Desktop.
Write a multiline git commit message and push directly
This file contains 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
c(){ | |
# Stage only modified files | |
# This ignores new/untracked files | |
git add -u . | |
# Use CTRL+D to end commit message | |
local COMMIT_MSG=$(cat) | |
if [[ -z "$COMMIT_MSG" ]]; then | |
return | |
fi | |
# Read the commit message from STDIN | |
echo "$COMMIT_MSG" | git commit -F - &&\ | |
git push -u origin HEAD | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment