git-rewrite-commits

(★ 1,418)

AI-powered git commit message rewriter using Ollama or GPT

File Explorer

  • .env.example
  • .gitignore
  • .npmignore
  • COMMIT_MESSAGE.md.example
  • CONTRIBUTING.md
  • example.js
  • git-rewrite-commits.png
  • LICENSE
  • package-lock.json
  • package.json
  • pnpm-lock.yaml
  • QUICK_START.md
  • README.md
  • SECURITY.md
  • tsconfig.json

# Use via CDN

jsDelivr

jsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.

Command Glossary

Commands referenced in this DOCs, explained below.

🔍

git add

View Details ▼

Stage changed files for a commit.

git add {{path/to/file}}

Stage a file for a commit:

git add {{[-A|--all]}}

Add all files (tracked and untracked):

git add .

Add all files recursively starting from the current folder:

🔍

git checkout

View Details ▼

Checkout a branch or paths to the working tree.

git checkout -b {{branch_name}}

Create and switch to a new branch:

git checkout -b {{branch_name}} {{reference}}

Create and switch to a new branch based on a specific reference (branch, remote/branch, tag are examples of valid references):

git checkout {{branch_name}}

Switch to an existing local branch:

🔍

git commit

View Details ▼

Commit files to the repository.

git commit

Open an editor to write a message and commit staged files to the repository:

git commit {{[-m|--message]}} "{{message}}"

Commit staged files to the repository with the specified message:

git commit {{[-F|--file]}} {{path/to/commit_message_file}}

Commit staged files with a message read from a file:

🔍

git config

View Details ▼

Manage custom configuration options for Git repositories.
These configurations can be local (for the current repository) or global (for the current user).

git config --global {{user.name|user.email}} "{{Your Name|[email protected]}}"

Globally set your name or email (this information is required to commit to a repository and will be included in all commits):

git config --{{local|global|system}} {{[-l|--list]}} --show-origin

List local, global, or system configuration entries and show their file location:

git config --global {{alias.unstage}} "reset HEAD --"

Set the global value of a given configuration entry (in this case an alias):

🔍

git filter-branch

View Details ▼

Change branch history, like removing files.

git filter-branch --tree-filter 'rm {{[-f|--force]}} {{file}}' HEAD

Remove a file from all commits:

git filter-branch --env-filter 'GIT_AUTHOR_EMAIL={{new_email}}' HEAD

Update author email:

git filter-branch --tree-filter 'rm {{[-rf|--recursive --force]}} {{folder}}' HEAD

Delete a folder from history:

🔍

git log

View Details ▼

Show a history of commits.

git log

Show the sequence of commits starting from the current one, in reverse chronological order of the Git repository in the current working directory:

git log {{[-p|--patch]}} {{path/to/file_or_directory}}

Show the history of a particular file or directory, including differences:

git log --stat

Show an overview of which file(s) changed in each commit:

🔍

git push

View Details ▼

Push commits to a remote repository.

git push

Send local changes in the current branch to its default remote counterpart:

git push {{remote_name}} {{local_branch}}

Send changes from a specific local branch to its remote counterpart:

git push {{[-u|--set-upstream]}} {{remote_name}} {{local_branch}}

Send changes from a specific local branch to its remote counterpart, and set the remote one as the default push/pull target of the local one:

🔍

npm install

View Details ▼

Install Node packages.

npm {{[i|install]}}

Install dependencies listed in `package.json`:

npm {{[i|install]}} {{package_name}}@{{version}}

Download a specific version of a package and add it to the list of dependencies in `package.json`:

npm {{[i|install]}} {{package_name}} {{[-D|--save-dev]}}

Download the latest version of a package and add it to the list of dev dependencies in `package.json`:

🔍

npx

View Details ▼

This command is an alias of `npm exec`.

tldr npm exec

View documentation for the original command:

🔍

ollama

View Details ▼

A large language model runner.
For a list of available models, see <https://ollama.com/library>.

ollama serve

Start the daemon required to run other commands:

ollama run {{model}}

Run a model and chat with it (will automatically download the model if it's not downloaded):

ollama run {{model}} --think=false "{{prompt}}"

Run a model with a single prompt and thinking turned off:

// repository documentation