Keeping your git repository clean can be a pain, especially when working with large teams and large codebases. Are you lost in the giant pile of outdated branches of remote? Tired of asking all your team members to clear their unused branches? Git Housekeeper is here to help!
This utility helps you review all the branches on remote, and remove any unused branches if necessary.
In order to easily generate Google Sheets, git-housekeeper hosts an API that calls the Google API with the meta information of the branches in your repository. If you would rather not share repository information with our API, you have the option to use to the Google API directly. Follow these instructions if you want to use the Google API directly.
- A Google Sheet will be generated by Git Housekeeper containing information on all remote branches. Click here to see an example sheet
- Share this Google Sheet with your team. You can now collaboratively decide which branches to keep by selecting either
KEEP
orDELETE
in the action column of each row. The row will turn red or green depending on the selected action. - Return to Git Housekeeper to process the sheet. It will list all the branches that have been marked with
DELETE
, and (after your confirmation) batch delete all those branches.
If you would rather not use Google Sheets and review the remote branches by yourself, you can run in interactive mode. Select "ask me which branches I would like to keep" from the menu.
Sometimes a local branch is tracking a branch on remote, but the remote branch is already gone. This can often happen when the branch is finished on another machine, or if the branch has been merged using a web interface. This utility lists all those branches, and if needed cleans them all up in one batch!
- Install Node.JS v6.0.0 or higher
- Install the package using
npm install -g git-housekeeper
It is recommended to install the git-housekeeper package globally, so you can run it from any directory. However, you can also include it as a dev-dependency in your project.
To use the source code instead of installing from NPM:
- Clone this repository
- Build the project using
npm run build
- Run commands using
node main.js <args>
instead ofgit-housekeeper <args>
Run one of the commands listed below. Then follow the on-screen instructions
git-housekeeper [options] <path>
run git-housekeeper on the given repositorygit-housekeeper process-sheet [options] <path>
process a Google Sheet previously created with git-housekeeper
path
[string] the path to the repository to analyse, relative to the current working directory.
-d, --dry-run
Executes a dry run (won't remove any branches) defaults tofalse
--version
Show version number--help
Show help
When trying to connect to an https
git remote, Git Housekeeper should automatically prompt you to enter a username and password.
If your remote is setup using ssh
instead, you need to run an SSH agent in the background with valid keys.
On Windows, pageant can be used as an SSH agent.