Skip to content

Commit 775c4f8

Browse files
committed
add README.md
1 parent eb81b18 commit 775c4f8

File tree

3 files changed

+68
-3
lines changed

3 files changed

+68
-3
lines changed

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# git-checkout-interactive
2+
3+
## A cli application for interactively checking out branches
4+
5+
## Installation
6+
7+
```sh
8+
go get -u github.com/giannimassi/git-checkout-interactive
9+
```
10+
11+
If $GOBIN is available in your $PATH the command can be used as `git checkout-interactive`.
12+
13+
### Optional
14+
15+
You can also add the following to your `.gitconfig` to provide a simpler to use alias for this command:
16+
17+
```ini
18+
[alias]
19+
cb = checkout-interactive --sort=-committerdate
20+
```
21+
22+
After adding this alias you can simply call this to choose a branch from the latest ones:
23+
24+
```sh
25+
git cb
26+
```
27+
28+
This is just an example, you can add flags and arguments as needed in the alias.
29+
30+
## Usage
31+
32+
```sh
33+
git checkout-interactive <git branch arguments and flags>
34+
```
35+
36+
Displays the current branch and allows to circle through branches listed with `git branch` and the provided flag and arguments.
37+
38+
- press down/left/j to select next branch
39+
- press up/right/h to select previous branch
40+
- press enter to checkout selected branch
41+
- press ESC or ctrl-c to exit without any changes
42+
43+
### Examples
44+
45+
```sh
46+
git checkout-interactive
47+
```
48+
49+
Choose a branch to checkout among the local branches.
50+
51+
```sh
52+
git checkout-interactive -a
53+
```
54+
55+
Choose a branch to checkout among all branches, both local and remote.
56+
57+
```sh
58+
git checkout-interactive --sort=-committerdate
59+
```
60+
61+
Choose a branch to checkout among the local branches listed by most recent commit.
62+
63+
64+
#### Have fun versioning!

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
module github.com/giannimassi/git-checkout-interactive
1+
module github.com/giannimassi/git-checkout-branch
22

33
go 1.13
44

55
require (
66
github.com/eiannone/keyboard v0.0.0-20200508000154-caf4b762e807
77
github.com/fatih/color v1.9.0
8+
github.com/giannimassi/git-checkout-interactive v0.1.0 // indirect
89
github.com/gosuri/uilive v0.0.4
9-
github.com/mattn/go-isatty v0.0.12 // indirect
10-
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 // indirect
1110
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ github.com/eiannone/keyboard v0.0.0-20200508000154-caf4b762e807 h1:jdjd5e68T4R/j
22
github.com/eiannone/keyboard v0.0.0-20200508000154-caf4b762e807/go.mod h1:Xoiu5VdKMvbRgHuY7+z64lhu/7lvax/22nzASF6GrO8=
33
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
44
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
5+
github.com/giannimassi/git-checkout-interactive v0.1.0 h1:gbbTur4bHop1U1M9uZCy78d4nBLds9Ubh0dDOxuzJ5k=
6+
github.com/giannimassi/git-checkout-interactive v0.1.0/go.mod h1:2LarWkJjtMJ4kh97ySkJ7zR2CTP2TKe1hCkxieHbsWQ=
57
github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY=
68
github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI=
79
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=

0 commit comments

Comments
 (0)