hit-on icon indicating copy to clipboard operation
hit-on copied to clipboard

[RFC] `hit go` for branch switching

Open vrom911 opened this issue 6 years ago • 1 comments
trafficstars

I see how it could be used in several situations.

Let's say you have the following branches locally:

  1. user/42-branch
  2. user/100-branch
  3. user/branch

Existing branch with the corresponding issue

The hit go command should have an optional int value, which should represent the issue number. And when you say:

$ hit go 42

it should checkout to the branch user/42-branch.

Non-existing issue branch

If there is no such branch which applies to the given issue then it should interactively ask you you would like to create the corresponding branch. If the answer is yes then it should behave as hit new NUM command.

$ hit go 1
There is no branch related to issue 1.
Would you like to create a new one branching from master? [y]/n
> Y
* hit new 1
> N
Aborting go

Branch without issue

If you want to switch to the branch which doesn't belong o the issue you can run just hit go and it should give you options of the branches you can switch to. And you'll just pick one:

$ hit go
[1]:  user/42-branch
[2]: user/100-branch
[3]: user/branch
> 3
* git checkout user/branch

vrom911 avatar Oct 04 '19 08:10 vrom911

@vrom911 This is a super cool idea! Would love to see this feature :slightly_smiling_face:

chshersh avatar Oct 04 '19 08:10 chshersh