Skip to content

Instantly share code, notes, and snippets.

@ksaitor
Created September 6, 2024 07:06
Show Gist options
  • Save ksaitor/bef79c30bc48a0de5ae7311df79fb3c9 to your computer and use it in GitHub Desktop.
Save ksaitor/bef79c30bc48a0de5ae7311df79fb3c9 to your computer and use it in GitHub Desktop.
# add this to your .bashrc or .aliases or .zshrc
ship() {
if [ $# -eq 0 ]; then
message="improvement" # Default commit message
else
message="$*" # Combine all arguments into a single commit message
fi
git commit -am"$message" # Commit changes
git pull origin HEAD & # Pull and auto-merge changes from the remote repository
# Check if the pull was successful
wait $!
if [ $? -ne 0 ]; then
echo "Git pull failed. Resolve conflicts or check for errors before proceeding."
return 1
fi
git push origin HEAD &
}
@ksaitor
Copy link
Author

ksaitor commented Sep 6, 2024

@ksaitor
Copy link
Author

ksaitor commented Sep 6, 2024

next: AI

thinking of adding commit message generation with claude/chatgpt

doing a git diff, passing it to openai/antropic API via curl

inserting it into git commit -am"$message"

might take a few seconds to run and won't be as fast tho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment