Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/elstgav/branch-manager
oh-my-zsh plugin for managing branches
https://github.com/elstgav/branch-manager
git oh-my-zsh oh-my-zsh-plugin zsh-plugins
Last synced: 2 months ago
JSON representation
oh-my-zsh plugin for managing branches
- Host: GitHub
- URL: https://github.com/elstgav/branch-manager
- Owner: elstgav
- Created: 2016-02-02T18:04:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T22:53:01.000Z (2 months ago)
- Last Synced: 2024-04-13T00:47:45.131Z (2 months ago)
- Topics: git, oh-my-zsh, oh-my-zsh-plugin, zsh-plugins
- Language: Shell
- Homepage:
- Size: 33.2 KB
- Stars: 15
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-zsh-plugins - branch-manager - A plugin for managing `git` branches. (Plugins / Zinit (née zplugin))
- awesome-zsh-plugins - branch-manager - A plugin for managing `git` branches. (Plugins / ZSH on Windows)
- fucking-awesome-zsh-plugins - branch-manager - A plugin for managing `git` branches. (Plugins / ZSH on Windows)
- fucking-awesome-zsh-plugins - branch-manager - A plugin for managing `git` branches. (Plugins / ZSH on Windows)
- awesome-zsh-plugins - branch-manager - A plugin for managing `git` branches. (Plugins / ZSH on Windows)
README
# branch-manager [![GitHub tag](https://img.shields.io/github/v/tag/elstgav/branch-manager?label=version&sort=semver)](#changelog)
oh-my-zsh plugin for managing branchesUpdating branches can be a pain, especially if you have unsaved changes in your workspace. `branch-manager` makes it easier to perform updates by auto-stashing your changes before doing routine maintenance, and then returning you to your workspace.
## Usage
`branch-manager` adds the following commands to your shell:
- `update_branch [branch=current_branch]`
Pull `branch` and return to your workspace
*You can also use this to update other branches while staying in your own*
- `merge_branch [branch=default_branch]`
Merge `branch` into your own
- `rebase_branch [branch=default_branch]`
Rebase `branch` into your own- `pull_and_prune [branch=default_branch]`
Pull `branch` and delete all dead/merged branches.
*Useful for staying up-to-date with an active remote, while keeping your local repo tidy*## Determining Default Branch
For commands that default to the “default branch” (e.g. `master`/`main`), the default branch is determined by checking the following in order:
1. `git config init.defaultBranch`
2. `BRANCH_MANAGER_DEFAULT_BRANCH` environment variable
3. …otherwise defaults to `master`If it’s guessing wrong, the easiest way to fix it is to set the default branch per repo:
```sh
git config init.defaultBranch [your_branch_name_here]
```
or globally:
```sh
git config --global init.defaultBranch [your_branch_name_here]
```## Installation
`branch-manager` is built to work with [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh/), so you’ll need that installed first.
1. `$ cd ~/.oh-my-zsh/custom/plugins` (you may have to create the folder)
2. `$ git clone [email protected]:elstgav/branch-manager.git`
3. In your .zshrc, add `branch-manager` to your oh-my-zsh plugins:
```bash
plugins(rails git branch-manager)
```## Changelog
#### 1.7 April 12, 2024
- Update `pull_and_prune` to detect and delete squash-merged branches
#### 1.6 October 12, 2022
- Fix global namespace pollution by using local variables
#### 1.5 September 30, 2022
- Auto-detect default branch name (see [Determining Default Branch](#determining-default-branch) above)
#### 1.4 September 2, 2021
- Add autocompletion of branch names
#### 1.3.1 April 17, 2020
- Change `pull_and_prune` branch deletion message color
*Changed from red (danger) to yellow (warning), since branch deletion is expected behavior.*#### 1.3 April 16, 2020
- Add `pull_and_prune` command
#### 1.2.1 April 14, 2020
- Colorize status messages
- Print message when restoring stashed changes#### 1.2 April 14, 2020
- Include untracked files when auto-stashing changes
- Remove “no stash” feedback to reduce noise#### 1.1.1 October 16, 2017
- Fix warning message if post-checkout hook doesn’t exist ([#2](https://github.com/elstgav/branch-manager/issues/2))
#### 1.1 October 16, 2017
- Add `rebase_branch` command (Thanks [@blimmer!](https://github.com/blimmer))
#### 1.0 February 2, 2016