By Bimbok and adityapaul26
A powerful Bash-based Git automation tool that simplifies your GitHub workflow with an interactive menu system.
Bimagic is an interactive command-line tool that streamlines common Git operations, making version control more accessible through a user-friendly menu interface. It handles repository initialization, committing, branching, and remote operations with GitHub integration using personal access tokens.
bimagic in a terminal (kitty)
bimagic in neovim
- 🔮 Interactive menu-driven interface
- 🔐 Secure GitHub authentication via personal access tokens
- 📦 Easy repository initialization and setup
- 📥 Clone repositories (Standard or Interactive selection)
- 📊 Dynamic themed progress bar for cloning
- 🗜️ Shallow clone support (--depth)
- 🔄 Simplified push/pull operations
- 🌿 Branch management made easy
- 📊 Status dashboard (ahead/behind, branch, clean/uncommitted/conflicts)
- 🛡️ Automatic master-to-main branch renaming
- 🗑️ Safe file/folder removal with git integration
- 📈 Contributor statistics with time range selection
- 🌐 Git graph (pretty git log) viewer
- 📜 The Architect (.gitignore generator)
- 🔀 Merge branches with conflict detection
- ⏪ Revert commit(s) with multi-select
- 🎨 Theme Customization (ANSI and Hex color support)
- ⏳ Time Turner (Undo last commit)
- 🗃️ Stash operations (Push, Pop, List, Apply, Drop, Clear)
Run this one-line command to install Bimagic:
curl -sSL https://raw.githubusercontent.com/Bimbok/bimagic/main/install.sh | bashYou can also install bimagic using npm.
npm i -g bimagicThe installer automatically sets up a Ctrl + B keybinding for Zsh, Bash, and Fish shells. This allows you to summon the Git Wizard from anywhere in your terminal instantly!
- Zsh: Uses a custom ZLE widget to ensure a clean UI transition.
- Bash: Uses
bind -xfor direct execution. - Fish: Uses
bind \cbwith a repaint command.
Note: You may need to restart your terminal or source your config file (e.g., source ~/.zshrc) after installation for the keybinding to take effect.
You can use Bimagic directly inside Neovim! This integration wraps the CLI tool in a floating terminal window using toggleterm.nvim for a seamless workflow.
Create a new plugin file (e.g., ~/.config/nvim/lua/plugins/bimagic.lua) with the following configuration. This sets up a <leader>gm keybinding to launch the wizard in a floating popup.
return {
{
"akinsho/toggleterm.nvim",
opts = function(_, opts)
opts.size = 20
opts.open_mapping = [[<c-\>]]
end,
keys = {
{
"<leader>gm",
function()
local Terminal = require("toggleterm.terminal").Terminal
local bimagic = Terminal:new({
cmd = "bimagic", -- This assumes 'bimagic' is in your global PATH
hidden = true,
direction = "float",
float_opts = {
border = "curved", -- 'single', 'double', 'shadow', 'curved'
width = 100,
height = 25,
title = " Bimagic Git Wizard ",
},
close_on_exit = true,
on_open = function(term)
vim.cmd("startinsert!")
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", { noremap = true, silent = true })
end,
})
bimagic:toggle()
end,
desc = "Bimagic (Git Wizard)",
},
},
},
}- Clone the repository:
git clone https://github.com/Bimbok/bimagic.git- Make the script executable:
chmod +x bimagic/bimagic- Move it to your bin directory:
# Option 1: For user-local installation (no sudo required)
mkdir -p ~/bin
mv bimagic/bimagic ~/bin/
# Option 2: For system-wide installation (requires sudo)
sudo mv bimagic/bimagic /usr/local/bin/- Ensure the bin directory is in your PATH (add to ~/.bashrc or ~/.zshrc if needed):
export PATH="$HOME/bin:$PATH" # For user-local installation- gum (required for modern UI and interactive selection)
- See installation instructions below or use the automated script.
- If not installed, the tool will not work.
- Node.js v16 or higher
- npm v8+
Bimagic requires your GitHub username and a personal access token. Add these to your shell configuration file:
- Open your shell configuration file:
# For bash users
nano ~/.bashrc
# For zsh users
nano ~/.zshrc- Add these lines at the end of the file:
# GitHub credentials for bimagic
export GITHUB_USER="your_github_username"
export GITHUB_TOKEN="your_github_personal_access_token"- Reload your shell configuration:
source ~/.bashrc # or source ~/.zshrcBimagic allows you to fully customize the UI colors through a theme file.
- Location: The theme file is located at
~/.config/bimagic/theme.wz. - Formats: You can use ANSI color numbers (0-255) or Hex codes (#RRGGBB).
- TrueColor Support: Hex codes will automatically enable TrueColor mode in supported terminals.
# Bimagic Theme - Arctic Neon
# Copy this to ~/.config/bimagic/theme.wz
# Primary color - Neon Cyan
BIMAGIC_PRIMARY="#00FFFF"
# Secondary color - Deep Sky Blue
BIMAGIC_SECONDARY="#00AFFF"
# Success color - Spring Green
BIMAGIC_SUCCESS="#00FF87"
# Error color - Hot Pink
BIMAGIC_ERROR="#FF005F"
# Warning color - Amber
BIMAGIC_WARNING="#FFD700"
# Info color - Seafoam
BIMAGIC_INFO="#00FFAF"
# Muted color - Steel Grey
BIMAGIC_MUTED="243"
# Banner Gradients (Deep Blue to Cyan)
BANNER_COLOR_1="21"
BANNER_COLOR_2="27"
BANNER_COLOR_3="33"
BANNER_COLOR_4="39"
BANNER_COLOR_5="45"Create a new file at ~/.config/matugen/templates/bimagic-theme.wz:
# Bimagic Theme - Generated by Matugen
# Do not edit manually!
BIMAGIC_PRIMARY="{{colors.primary.default.hex}}"
BIMAGIC_SECONDARY="{{colors.secondary.default.hex}}"
# Material You doesn't have strict 'success/warning', so we map them to complementary accent colors
BIMAGIC_SUCCESS="{{colors.tertiary.default.hex}}"
BIMAGIC_ERROR="{{colors.error.default.hex}}"
BIMAGIC_WARNING="{{colors.tertiary_container.default.hex}}"
BIMAGIC_INFO="{{colors.primary_container.default.hex}}"
# Muted colors for hints
BIMAGIC_MUTED="{{colors.outline.default.hex}}"
# Banner Gradients (Creating a smooth transition using Material shades)
BANNER_COLOR_1="{{colors.primary.default.hex}}"
BANNER_COLOR_2="{{colors.primary_fixed.default.hex}}"
BANNER_COLOR_3="{{colors.secondary.default.hex}}"
BANNER_COLOR_4="{{colors.secondary_fixed.default.hex}}"
BANNER_COLOR_5="{{colors.tertiary.default.hex}}"
Open your Matugen config (usually ~/.config/matugen/config.toml) and add this block to the bottom:
[templates.bimagic]
input_path = "~/.config/matugen/templates/bimagic-theme.wz"
output_path = "~/.config/bimagic/theme.wz"
Run your usual matugen command to generate colors from your current wallpaper. For example:
matugen image /path/to/your/wallpaper.jpg
- Go to GitHub → Settings → Developer settings → Personal access tokens
- Click "Generate new token"
- Give your token a descriptive name (e.g., "bimagic-cli")
- Select the "repo" scope (this provides full control of private repositories)
- Click "Generate token"
- Copy the token immediately (you won't be able to see it again!)
Simply run the bimagic command in your terminal:
bimagicPro Tip:
- Press Ctrl + B in your terminal to quickly summon the wizard from anywhere!
- You can also use the short alias wz (Wizard) for even faster access!
wzYou can also use flags to perform specific actions immediately:
- Clone Repository:
bimagic -d "repo-url" - Shallow Clone:
bimagic -d "repo-url" --depth 1 - Interactive Clone (Select specific files/folders to download):
bimagic -d -i "repo-url" - The Lazy Wizard (Add + Commit + Push):
bimagic -z "commit message" - The Crystal Ball (Show Status Dashboard):
bimagic -s
- The Time Scroll (Show Git Graph):
bimagic -g
- The Time Turner (Undo last commit):
bimagic -u
- The Architect (Summon .gitignore):
bimagic -a
You'll be presented with an interactive menu where you can choose from various Git operations.
At the top of the interface, a status box summarizes:
- Current
GITHUB_USERand branch - Ahead/behind counts relative to upstream (if set)
- Working tree state: clean, uncommitted, or conflicts
- Clone repository - Clone a repository from a URL (supports standard and interactive modes)
- Init new repo - Initialize a new Git repository (auto-renames master → main)
- Add files - Stage files (interactive multi-select; includes [ALL])
- Commit changes - Commit staged changes with a choice between Magic Commit (Conventional Builder) or Quick Commit (One-line)
- Push to remote - Push changes (handles multiple remotes and auto-configuration)
- Pull latest changes - Fetch and merge changes from remote
- Create/switch branch - Create a new branch or switch to an existing one
- Set remote - Configure remotes (supports HTTPS with token or SSH)
- Show status - Display repo status dashboard (ahead/behind, branch, cleanliness)
- Contributor Statistics - View per-author activity with time range selection
- Git graph - Pretty git log with graph and decorations
- Remove files/folders (rm) - Safely remove files/folders with git integration
- Summon the Architect (.gitignore) - Interactive .gitignore generator with 70+ blueprints
- Merge branches - Merge a selected branch into the current one
- Uninitialize repo – Remove Git tracking from a project
- Revert commit(s) - Revert one or more commits (multi-select)
- Stash operations - Manage stashes (push, pop, list, apply, drop, clear)
- Exit - Quit the wizard
This feature allows you to clone a repository with two modes, both featuring a themed progress bar to show real-time download status:
Perform a full or shallow git clone of the target repository.
- Usage from CLI:
bimagic -d "repo-url" [--depth <number>]
If you only need specific files or folders from a large repository, this mode allows you to:
- Download the repository metadata without file contents.
- Select specific files/folders interactively.
- Download only the selected items into your local directory.
Usage from CLI: bimagic -d -i "repo-url"
Bimagic offers two ways to commit your staged changes:
The "Commit Spell" - a guided experience that helps you follow the Conventional Commits specification. It prompts you for:
- Type: feat, fix, docs, style, refactor, perf, test, chore.
- Scope: The area of the code being changed (optional).
- Description: A short, imperative-mood summary.
- Body: Detailed description (optional).
- Breaking Changes: Automatically adds
!to the type/scope for visibility.
For when you just want to provide a quick message and move on.
Analyze contributions over a chosen time range (Last 7/30/90 days, Last year, All time). The tool parses git log --numstat to compute per-author lines changed and commit counts, and surfaces highlights like most active/productive contributors.
- Per-author bar visualization and percentages
- Lines changed and commit counts
- Highlights: most active and most productive
Displays a pretty, colorized git log --graph with abbrev commit, decorations, author, date, and subject. Press q to exit the view.
The Remove files/folders (rm) option lets you select files and folders interactively, with full git integration:
- Interactive Multi-select: Select one or many files to remove
- Git Integration: Tracked files are removed via
git rm -rf; untracked viarm -rf - Safety Confirmation: Explicit confirmation before deletion
- Smart Detection: Works whether or not a file is tracked in git
- A list of tracked and untracked files is displayed
- Use the interactive filter to multi-select entries (TAB to select, ENTER to confirm)
- The selection is previewed and you are asked to confirm (y/N)
- Each selected item is removed appropriately (git-tracked or filesystem)
- A success message lists removed paths
"The Architect" is a powerful .gitignore generator that pulls the latest industry-standard blueprints directly from GitHub's official collection.
- 70+ Blueprints: Supports everything from Node, Python, and Rust to Flutter, Unity, and TeX.
- Interactive Search: Use
gum filterto quickly find your language or framework. - Safety First: Asks for confirmation before overwriting an existing
.gitignorefile. - Always Up-to-Date: Fetches directly from the source to ensure you have the latest rules.
Usage from CLI: bimagic -a or bimagic --architect
Merge another branch into your current branch using an interactive selector. If conflicts occur, you will be notified to resolve them manually.
- Current branch is shown
- Select a branch (other than current) to merge into the current one
- If merge succeeds, you get a success message; otherwise, conflicts are reported
- Double confirmation for
*(everything) - requires typing "yes" - Preview of what will be deleted before proceeding
- Existence check - only proceeds if files actually exist
- Git-aware - uses
git rmfor tracked files, regularrmfor untracked files Revert one or more commits selected via interactive filter fromgit log --oneline. Each selected commit is reverted in sequence; on conflicts, the process stops and you are instructed to resolve and continue.
- Select commit(s) to revert (multi-select)
- Confirm the action (y/N)
- Reverts run with
git revert --no-edit - On conflict, resolve then run
git revert --continue
This feature is essentially an "Undo Button" for Git. It allows you to undo the last commit with three levels of severity:
Cancels the commit but leaves your files staged. Best for fixing typos or adding forgotten files.
- Scenario: You committed "Added login" but forgot
login.css. - Result: Files are green (staged), ready to commit again.
Cancels the commit and unstages the files. Best for when you want to split work into multiple commits.
- Scenario: You committed backend and frontend work together but want to separate them.
- Result: Files are red (modified), keeping your work but not staged.
Destroys the commit and all changes. Reverts to the previous state.
- Scenario: You want to trash the last commit completely.
- Result: Everything from that commit is gone forever. Use with caution!
Manage your git stashes with a comprehensive menu.
- Push (Save): Stash changes with an optional message and support for untracked files
- Pop: Apply and remove the latest stash
- List: View all saved stashes
- Apply: Apply a specific stash without removing it
- Drop: Delete a specific stash
- Clear: Remove all stashes (with safety confirmation)
The installation script may request sudo privileges for these reasons:
-
System-wide installation:
- The script tries to install to
/usr/local/bin/by default - This directory is typically owned by root for security reasons
- Writing to system directories requires administrative privileges
- The script tries to install to
-
Directory permissions:
- If you don't have a
~/bindirectory or it's not writable - The script falls back to system installation
- If you don't have a
You can avoid needing sudo by:
-
Creating a local bin directory:
mkdir -p ~/bin -
Ensuring it's in your PATH (add to ~/.bashrc or ~/.zshrc):
export PATH="$HOME/bin:$PATH"
-
Running the installation again
-
Token Security:
- Your GitHub token is stored in your shell configuration file
- Protect this file with proper permissions (chmod 600)
- Never share your token or commit it to version control
-
Script Integrity:
- Review the installation script before running it
- The script only copies files and sets permissions
-
Network Security:
- The script uses HTTPS to communicate with GitHub
- Ensure you're on a secure network when using the tool
-
"Command not found" after installation
- Your bin directory may not be in PATH
- Add
export PATH="$HOME/bin:$PATH"to your shell config file - Run
source ~/.bashrcorsource ~/.zshrc
-
Permission denied errors
- The script might not be executable
- Run
chmod +x ~/bin/bimagicorsudo chmod +x /usr/local/bin/bimagic
-
GitHub authentication errors
- Verify your GITHUB_USER and GITHUB_TOKEN environment variables are set correctly
- Ensure your token has the necessary permissions
-
Remote operation failures
- Check your internet connection
- Verify the repository name is correct
If you encounter issues:
- Check that Git is installed:
git --version - Verify your environment variables are set:
echo $GITHUB_USER - Ensure you have a GitHub personal access token with repo permissions
If you ever need to remove Bimagic from your system, you have two options:
Run the uninstall script directly from GitHub:
curl -sSL https://raw.githubusercontent.com/Bimbok/bimagic/main/uninstall.sh | bash-
Remove the Bimagic script:
# Remove from user directory (if installed there) rm -f ~/bin/bimagic # Remove from system directory (if installed there - requires sudo) sudo rm -f /usr/local/bin/bimagic
-
Optional: Remove GitHub credentials from your shell configuration:
# Edit your shell config file (e.g., ~/.bashrc, ~/.zshrc) # Remove lines containing GITHUB_USER and GITHUB_TOKEN nano ~/.bashrc # or ~/.zshrc ```### What the Uninstall Script Does
-
Finds Installations: Checks common installation directories (~/bin and /usr/local/bin)
-
Confirmation: Asks for confirmation before proceeding
-
Removes Bimagic: Deletes the script and
wzalias from all found locations -
Cleans Shell Config: Offers to remove GITHUB_USER, GITHUB_TOKEN, and the Ctrl + B shell integrations from your config files
-
Creates Backups: Creates timestamped backups of modified shell configuration files
- Asks for confirmation before removing anything
- Creates backups of modified configuration files
- Uses sudo only when necessary (for system directories)
- Provides clear feedback about what's happening
- Includes timestamped backups to prevent data loss
- The uninstall script will only remove the Bimagic script file
- Your Git repositories and other files will not be affected
- GitHub credentials are only removed if you explicitly choose to do so
- Backups are created before modifying any configuration files
Remember to update your repository with both the uninstall.sh script and the updated README section.
Contributions to Bimagic are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
This project is open source and available under the MIT License.
This tool is provided as-is without any warranties. Use it at your own risk. Always ensure you have backups of important repositories before performing operations with this tool.
Enjoy the magical Git experience! ✨


