134 lines
2.1 KiB
Markdown
134 lines
2.1 KiB
Markdown
# GIMS
|
|
> Git Made Simple
|
|
|
|
|
|
<br>
|
|
|
|
## 🚀 Installation
|
|
|
|
```bash
|
|
npm install -g gims
|
|
```
|
|
|
|
This installs the `gims` command and a shortcut alias:
|
|
|
|
```bash
|
|
g # shortcut for gims
|
|
```
|
|
|
|
<br><br>
|
|
|
|
## 🔧 Environment Setup (Optional for AI)
|
|
|
|
To enable AI-generated commit messages:
|
|
|
|
### ✅ Option 1: Gemini API
|
|
|
|
```bash
|
|
export GEMINI_API_KEY='your_gemini_api_key'
|
|
```
|
|
|
|
### ✅ Option 2: OpenAI API (used if Gemini key not found)
|
|
|
|
```bash
|
|
export OPENAI_API_KEY='your_openai_api_key'
|
|
```
|
|
|
|
If neither is set, it defaults to a generic commit message.
|
|
|
|
<br><br>
|
|
|
|
## 🧠 AI Commit Modes
|
|
|
|
### 1. Commit Locally with AI Message
|
|
|
|
```bash
|
|
g l # or gims local
|
|
```
|
|
|
|
→ Adds and commits current changes locally with a descriptive commit message generated by AI.
|
|
|
|
### 2. Commit & Push with AI Message
|
|
|
|
```bash
|
|
g o # or gims online
|
|
```
|
|
|
|
→ Adds, commits, and pushes the current changes to the remote branch.
|
|
|
|
<br><br>
|
|
|
|
## 📚 Version History Navigation
|
|
|
|
### View Git Logs (Short)
|
|
|
|
```bash
|
|
g ls # or gims list
|
|
```
|
|
|
|
→ Shows a numbered short log:
|
|
|
|
```
|
|
1. 1234abc Added login feature
|
|
2. 5678def Fixed bug in auth flow
|
|
```
|
|
|
|
### View Git Logs (Full)
|
|
|
|
```bash
|
|
g ll # or gims largelist
|
|
```
|
|
|
|
→ Full `git log` (without pager).
|
|
|
|
<br><br>
|
|
|
|
## 🌿 Branching & Resetting
|
|
|
|
### Create Branch from a Commit or Number
|
|
|
|
```bash
|
|
g b 2 try-new-idea
|
|
```
|
|
|
|
→ Branches off from commit #2 (resolved via `g ls`) into a new branch `try-new-idea`.
|
|
|
|
### Reset to a Commit or Number
|
|
|
|
```bash
|
|
g r 1 --hard
|
|
```
|
|
|
|
→ Resets the current branch to commit #1 permanently (`--hard` is optional).
|
|
|
|
### Revert a Commit or Number
|
|
|
|
```bash
|
|
g rv 3
|
|
```
|
|
|
|
→ Reverts changes made by commit #3 (safe, non-destructive).
|
|
|
|
<br><br>
|
|
|
|
## 🆕 Git Init
|
|
|
|
```bash
|
|
g i # or gims init
|
|
```
|
|
|
|
→ Initializes a new Git repository.
|
|
|
|
<br><br>
|
|
|
|
## 📝 Example Workflow
|
|
|
|
```bash
|
|
cd myproject/
|
|
g i # Initialize repository
|
|
touch index.js # Add file
|
|
g l # Auto commit locally with AI
|
|
g ls # See commit history
|
|
g b 1 try-feature # Branch out from earlier version
|
|
```
|