Skip to content

giannimassi/git-checkout-branch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build

git-checkout-branch

A cli application for interactively checking out branches

asciicast

Installation

go get -u github.com/giannimassi/git-checkout-interactive

If $GOBIN is available in your $PATH the command can be used as git checkout-interactive.

Optional

You can also add the following to your .gitconfig to provide a simpler to use alias for this command:

[alias]
    cb = checkout-interactive --sort=-committerdate

After adding this alias you can simply call this to choose a branch from the latest ones:

git cb

This is just an example, you can add flags and arguments as needed in the alias.

Usage

git checkout-interactive <git branch arguments and flags>

Displays the current branch and allows to circle through branches listed with git branch and the provided flag and arguments.

  • press down/left/j to select next branch
  • press up/right/h to select previous branch
  • press enter to checkout selected branch
  • press ESC or ctrl-c to exit without any changes

Examples

git checkout-interactive

Choose a branch to checkout among the local branches.

git checkout-interactive -a

Choose a branch to checkout among all branches, both local and remote.

git checkout-interactive --sort=-committerdate

Choose a branch to checkout among the local branches listed by most recent commit.

Have fun versioning!