Skip to content

Commit 8e91b5d

Browse files
authored
Merge pull request #3 from wesleyscholl/ABC-1234
Abc 1234
2 parents e8737c2 + e38a502 commit 8e91b5d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

README.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Staging, committing, and pushing code is a repetative manual process. Writing de
55
## Table of Contents
66

77
- [What this script automates](#what-this-script-automates)
8-
- [User input required](#user-input-required)
98
- [Requirements](#requirements)
109
- [Installation](#installation)
1110
- [Usage](#usage)
@@ -22,19 +21,14 @@ Staging, committing, and pushing code is a repetative manual process. Writing de
2221
| Git Push | Pushing local commits to remote branch with `git push`. |
2322
| Git Push Retry (Pull & Push) | If a push fails, the script will `git pull` from the remote branch and push again. |
2423

25-
## Alias Command
26-
27-
| Name | Description |
28-
| -------------- | -------------------------------------------------------- |
29-
| Alias Command | The alias command to be used for the script: `cm`. |
30-
3124
## Requirements
3225

3326
| Name | Description | Link, Location, or Command |
3427
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
3528
| Terminal or Shell | A terminal or shell for configuring and running the script. | [Download Terminal](https://www.apple.com/macos/terminal/) |
3629
| `Git Bash` **\*Required for Windows** | Git Bash provides a Unix command line emulator for windows which can be used to run Git, shell commands, and much more. | [Download Git Bash](https://gitforwindows.org/) |
3730
| Google Gemini API Key | A Gemini API key is required to use Gemini AI to generate commit messages. | [Get Gemini API Key](https://www.getgemini.ai/) |
31+
| Alias Command | The alias command to be used for the script: `cm`. | Bash profile (`.zshrc` or `.bash_profile`) |
3832

3933
## Installation
4034

git-commit-push-script.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ diff=$(git diff --cached)
1717
diff=$(echo $diff | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed 's/\n/\\n/g')
1818

1919
# Prepare the Gemini API request
20-
gemini_request='{"contents":[{"parts":[{"text": "Write a git commit message (commit message title 72 character maximum and commit message summary 50 character maxiumum) for the following git diff: '"$diff"' The format should be as follows (without titles, back ticks, or markdown fomatting): <commit message title> (2 new lines) <commit message summary>"}]}]}'
20+
gemini_request='{"contents":[{"parts":[{"text": "Write a git commit message title (no more than 72 characters total) for the following git diff: '"$diff"' "}]}]}'
2121

2222
# Get commit message from Gemini API
2323
commit_message=$(curl -s \
@@ -27,6 +27,9 @@ commit_message=$(curl -s \
2727
| jq -r '.candidates[0].content.parts[0].text'
2828
)
2929

30+
# Clean up commit message formatting - remove #, ```
31+
commit_message=$(echo $commit_message | sed 's/#//g' | sed 's/```//g' | sed 's/Commit message title://g' | sed 's/Commit message summary://g')
32+
3033
# Prepare and execute commit command
3134
git commit -S -m "$ticket $commit_message"
3235

0 commit comments

Comments
 (0)