Git management tool with a few workflows mapped out.
- Interactive Menu System: Navigate through Git operations with an easy-to-use menu interface
- Branch Management:
- List all local branches
- Delete multiple branches with a single command
- Force delete branches without confirmation
- Checkout branches with automatic updates
- Create and manage feature branches
- Create and manage hotfix branches
- Finish hotfix branches with proper merging
- Feature Branch Workflow:
- Automated workflow to create standardized feature branches
- Automatically stashes current changes
- Updates develop branch with latest changes
- Creates properly formatted branches (issue-key-branch-name)
- Restores stashed changes to new branch
- Hotfix Branch Workflow:
- Create hotfix branches from main/master
- Finish hotfixes with proper merging to main and develop
- Automatic version tagging
- Branch Management Utilities:
- Checkout branches with automatic stashing of changes
- Pull latest changes with rebase option
- Apply stashed changes automatically
- Smart branch naming with kebab-case conversion
- Node.js v22 or higher
- Git installed and available in your PATH
- Clone the repository:
git clone [https://github.com/richard-gaunt/git-manager.git](https://github.com/richard-gaunt/git-manager.git)
- Install dependencies:
npm install
- Make the script executable (Linux/macOS):
chmod +x index.js
For convenience, you can set up an alias in your .bashrc
or .zshrc
file:
- Open your
.bashrc
or.zshrc
file:
vim ~/.bashrc
# or
vim ~/.zshrc
- Add the following line, replacing
<path_to_app>
with the absolute path to your git-manager directory:
alias git_manager="node <path_to_app>/index.js"
-
Save and close the file
-
Apply the changes:
source ~/.bashrc
# or
source ~/.zshrc
Note: This application requires Node.js v22 or higher. Make sure you have the correct version installed:
node --version
If you need to update Node.js, consider using a version manager like nvm.
Simply run the alias without any arguments:
git_manager
This will display the interactive menu that allows you to:
- List all branches
- Delete branches
- Create feature branches
- Create and manage release branches
- Create and manage hotfix branches
- Checkout and update branches
- And more...
You can also run specific commands directly:
# List all branches
git_manager branches
# Delete branches
git_manager delete-branches
# Create feature branch
git_manager create-feature
# Create a release
git_manager create-release
# Finish a release
git_manager finish-release
# Create hotfix branch
git_manager create-hotfix
# Finish a hotfix branch
git_manager finish-hotfix
# Checkout and update a branch
git_manager checkout
When creating a feature branch, the tool will:
- Show your current uncommitted changes
- Automatically stash any changes
- Checkout the develop branch
- Update develop with
git pull --rebase
- Prompt for an issue key/number (e.g., JIRA-123)
- Prompt for a descriptive branch name
- Create a kebab-case branch in the format
JIRA-123-branch-name
- Restore your stashed changes to the new branch
This ensures consistent branch naming and up-to-date feature branches across your team.
When creating and finishing hotfix branches, the tool will:
- Create hotfix branches from the main/master branch
- When finishing a hotfix:
- Merge changes back to main/master
- Create a version tag
- Merge changes to develop to keep branches in sync
- Push changes to remote repositories
The checkout functionality provides:
- Interactive branch selection with autocomplete
- Automatic stashing of uncommitted changes
- Pulling latest changes from the remote
- Restoring stashed changes to the selected branch
git-manager/
├── index.mjs # Main entry point with Commander setup
├── api.mjs # Common git operations
├── package.json # Project metadata with dependencies
└── commands/ # Command modules
├── index.mjs # Command registry and loader
└── branches-actions.mjs # Branch workflow implementations
Git Manager uses Jest for testing with the following command structure:
# Run all tests
npm test
# Run only unit tests
npm run test:unit
# Run only integration tests
npm run test:integration
# Run only end-to-end tests
npm run test:e2e
# Generate test coverage report
npm run test:coverage
This project is licensed under the MIT License - see the LICENSE file for details.