Code Monkey home page Code Monkey logo

branch-manager's Introduction

branch-manager GitHub tag

oh-my-zsh plugin for managing branches

Updating 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:

git config init.defaultBranch [your_branch_name_here]

or globally:

git config --global init.defaultBranch [your_branch_name_here]

Installation

branch-manager is built to work with 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:
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

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)

1.1 October 16, 2017

  • Add rebase_branch command (Thanks @blimmer!)

1.0 February 2, 2016

branch-manager's People

Contributors

blimmer avatar elstgav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

angkira blimmer

branch-manager's Issues

Configure default branch

Obviously I can just go into the plugin and customize my version of it, but it would be neat to be able to override the default branch (master, currently) with a different one. As an example, for my personal projects i tend to use main these days, but at work we use development.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.