sodapopcan / vim-twiggy

Git branch management for Vim
280 stars 15 forks source link

Create new branch #22

Closed okkan closed 5 years ago

okkan commented 5 years ago

git checkout -b [new-branch-name] command would be useful...

sodapopcan commented 5 years ago

Twiggy branch-name currently creates a branch if it doesn't exist.

I was actually just thinking the other day that I might change this so that it confirms if the branch doesn't exist since I've made typos trying to check out another branch and not noticed (which is not nice behaviour). I'd then probably implement Twiggy! for intentional creation.

okkan commented 5 years ago

i mean it should be in quicklist, for example i move cursor to a remote branch or a local branch and then (may be [b] key) i press b key and i type new branch name... if i leave it empty, it will checkout as same name with remote branch. (webstorm has a feature like this "checkout as..." and it is very usefull)

sodapopcan commented 5 years ago

Ah, cool, yes, I'm certainly open to that. Lemme think on an implementation and I'll get back to you!

jrock2004 commented 5 years ago

So right now if I do :Twiggy Feature/new-cool-feature it will create that branch based off the current branch I am in right?

sodapopcan commented 5 years ago

Correct. I guess I could call that out more explicitly in the docs. It essentially acts like a cross between git checkout and git checkout -b. It also takes a base branch as a second parameter.

sodapopcan commented 5 years ago

Hi there @okkan, very sorry for the long delay on this.

So I've pushed an initial implementation. Could you possibly clarify what you mean by "if empty, it will checkout as the same name with remote branch"? As I currently have it, you can put you cursor on any branch (local or remote), hit go, and will be prompted to create a new branch based off of that branch. Leaving it empty, however, will cancel the operation.

okkan commented 5 years ago

@sodapopcan yeah you are right. Never mind that "if empty..." parts. Sorry it is my bad.

okkan commented 5 years ago

I've test it, it works like a charm. Thanx a lot.

sodapopcan commented 5 years ago

Ok, awesome! I should probably make gc work as well. I'll close this after I do.