https://github.com/mediamonks/git-housekeeper
A housekeeping utility to clean up your git repository
https://github.com/mediamonks/git-housekeeper
cli-app git google-sheets review-branches
Last synced: 11 days ago
JSON representation
A housekeeping utility to clean up your git repository
- Host: GitHub
- URL: https://github.com/mediamonks/git-housekeeper
- Owner: mediamonks
- Created: 2017-12-16T20:57:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T01:21:05.000Z (over 2 years ago)
- Last Synced: 2025-04-02T02:38:45.407Z (23 days ago)
- Topics: cli-app, git, google-sheets, review-branches
- Language: JavaScript
- Homepage:
- Size: 1.3 MB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Git Housekeeper
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!## Available utilities
### Review branches on remote
This utility helps you review all the branches on remote, and remove any unused branches if necessary.
#### Using Google Sheets
> 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](https://github.com/mediamonks/git-housekeeper/wiki/Using-Google-API)
> if you want to use the Google API directly.1. A Google Sheet will be generated by Git Housekeeper containing information on all remote branches.
[Click here to see an example sheet](https://docs.google.com/spreadsheets/d/1yptzd3ytvXT8ydxVdXOyPYt3sZu0jHrkslLn_Cil6IQ/edit?usp=sharing)
2. Share this Google Sheet with your team. You can now collaboratively decide which branches to keep by selecting either `KEEP` or `DELETE`
in the action column of each row. The row will turn red or green depending on the selected action.
3. 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.
#### Interactive mode
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.### Review tracking branches gone on remote
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!## Installation
- 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.### Building from source
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 ` instead of `git-housekeeper `## Usage
Run one of the commands listed below. Then follow the on-screen instructions
#### Commands
- `git-housekeeper [options] ` run git-housekeeper on the given repository
- `git-housekeeper process-sheet [options] ` process a Google Sheet previously created with git-housekeeper#### Arguments:
- `path` [string] the path to the repository to analyse, relative to the current working directory.#### Options
- `-d, --dry-run` Executes a dry run (won't remove any branches) _defaults to `false`_
- `--version` Show version number
- `--help` Show help#### Git authentication
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](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) can be used as an SSH agent.