A comprehensive CLI tool to manage Git repositories with ease. This tool provides a user-friendly menu interface for performing common Git operations, including specialized utilities for fixing branch rename issues.
- Git Status: View the current state of your repository
- Commit Management: Stage and commit changes with version tags
- Push/Pull Operations: Easily push to and pull from remotes
- Branch Management: Create, switch, rename, and delete branches
- Branch Rename Fix Utility: Fix issues with branch renaming and remote branch conflicts
- Merge Operations: Multiple merge strategies (regular, fast-forward, squash, rebase)
- Tag Management: Create, delete, and push tags
- Remote Management: Add, remove, and modify remote repositories
- Log Viewing: View repository history in different formats
- Untracked File Management: List, add, and clean untracked files
- File Picker: Browse, cherry-pick, and compare files across different branches
The project has evolved through several versions:
- v1: Initial version with basic Git operations
- v2: Added tag versioning and merge branches functionality
- v5: Modular version with libraries split into separate files
The main script (git-manager.sh) is now designed to work with separate library files for better maintainability. The file versions/v2_git-manager.sh is kept as a standalone demo version that includes all functionality in a single file.
-
Clone the repository:
git clone https://github.com/your-username/git-manager.git cd git-manager -
Run the setup script:
chmod +x setup-script.sh ./setup-script.sh
-
The setup script will:
- Check for required libraries
- Create the necessary directory structure
- Copy all library files to their correct locations
- Make the script executable
- Create a symbolic link (if possible)
-
Clone the repository:
git clone https://github.com/your-username/git-manager.git
-
Move to a suitable location:
mv git-manager ~/.git-manager -
Create the lib directory:
mkdir -p ~/.git-manager/lib -
Copy the library files:
cp git-manager/lib-*.sh ~/.git-manager/lib/
-
Rename the library files:
cd ~/.git-manager/lib/ for file in lib-*.sh; do mv "$file" "${file#lib-}"; done
-
Create a symbolic link:
ln -s ~/.git-manager/git-manager.sh /usr/local/bin/git-manager -
Make the script executable:
chmod +x ~/.git-manager/git-manager.sh
If you prefer to use the standalone demo version (all functionality in a single file):
-
Copy the demo version to a location of your choice:
cp versions/v2_git-manager.sh ~/git-manager.sh -
Make it executable:
chmod +x ~/git-manager.sh -
Run it from any Git repository:
~/git-manager.sh
Simply run the command from within a Git repository:
git-manager- Show git status: Display the current state of your repository
- Commit changes: Stage and commit files
- Push changes: Push changes to a remote repository
- Pull changes: Pull changes from a remote repository
- Branch management: Manage branches (create, switch, rename, delete)
- Fix branch rename issues: Fix issues with branch renaming
- Merge branches: Merge branches with various strategies
- Manage tags: Create, delete, and push tags
- Manage remotes: Configure remote repositories
- View logs: View repository history
- Manage untracked files: Handle untracked files
- Pick files from branches: Browse and copy files between branches
.
├── git-manager.sh # Main script file (modular version)
├── lib-*.sh # Library files (with 'lib-' prefix)
├── versions/ # Previous versions
│ ├── v1_git-manager.sh # Initial version
│ ├── v2_git-manager.sh # Enhanced version (standalone demo)
│ └── v5_git-manager.sh # Modular version
├── setup-script.sh # Installation script
└── README.md # This file
The modular version has some improvements over the standalone demo version (versions/v2_git-manager.sh):
- Better Organization: Each functionality is now in its own file for easier maintenance.
- Persistent Submenus: All submenus now stay open until you explicitly return to the main menu.
- File Picker: Added a new feature to browse, cherry-pick, and compare files across different branches.
Features that could be added in future versions:
- Stash Management: Save and apply stashes
- Git Flow Support: Integration with Git Flow branching model
- Git Hooks Management: Create and manage Git hooks
- Interactive Rebasing: Support for interactive rebasing operations
- Multiple Repository Management: Manage multiple Git repositories from a single interface
- Conflict Resolution: Improved tools for resolving merge conflicts
- History Visualization: Better visualization of repository history
- Configuration Management: Interface for managing Git configuration settings
This tool includes a specialized utility to fix the "refusing to delete the current branch" error that can occur when renaming branches. The fix works by:
- Renaming the local branch to the desired name
- Properly setting up the remote tracking
- Handling conflicts with existing remote branches
- Providing options to force-push or delete conflicting remote branches
To use this feature, select option 6 from the main menu and follow the prompts.
MIT License
Contributions are welcome! Please feel free to submit a Pull Request.
