jhermsmeier / git-branch-select Goto Github PK
View Code? Open in Web Editor NEWGit plugin for interactive branch listing, selection & checkout
License: MIT License
Git plugin for interactive branch listing, selection & checkout
License: MIT License
Hi @jhermsmeier ✋
I put incorrect name of branch and I that error ocured:
g branch-select
✔ Select a branch: › q
/Users/piecioshka/.nvm/versions/node/v8.9.4/lib/node_modules/git-branch-select/node_modules/command-join/command-join.js:24
for (let char of command) {
^
TypeError: command is not iterable
Maybe you can handle this and display error message without quiting interactive mode?
It would have been nice to have the option to sort by committerdate
instead of alphabetically, so that you get your most recently used branches first, like in:
git branch --sort=-committerdate
I love the git branch-select
feature (and actually I find it odd that such a useful usage isn't built in git, alongside git checkout -p
and git add -p
!)
Most often, I want to checkout a branch that has been freshly modified by a colleague, after a git fetch. Would it be possible and sensible to :
origin/xxx
that I've never checkouted yet, andHello,
when I run branch-select I get
$ git branch-select
? Select a branch: ›
❯ [object Object]
git branch works fine so I am really not understanding what is going on here:
$ git branch
feature/***
feature/$$$
feature/###
* master
Running node v12.7 and git v2.11 on Debian 9.
Thanks!
First try didn't work for me :
$ sudo npm install --global git-branch-select
$ git branch-select
/usr/local/lib/node_modules/git-branch-select/node_modules/prompt-base/index.js:819
var prompt = new this(...args);
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/git-branch-select/node_modules/prompt-checkbox/index.js:4:14)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
When running: git branch-select
`
/usr/local/lib/node_modules/git-branch-select/node_modules/prompts/dist/index.js:11
var _ref = _asyncToGenerator(function* (questions = [], { onSubmit = noop, onCancel = noop } = {}) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (/usr/local/lib/node_modules/git-branch-select/node_modules/prompts/index.js:3:7)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
'
When list shows up alphabetically, it would be extra-super-nice to type 2 or 3 letters of desired branch, to filter the list and display only the branches that contain this exact substring in their name (case-insensitive).
? Select branch (Use arrow keys)
> Assemblyman
Amusingness
Antitruster
Antielitist
Autoclaving
pha
? Select branch (Use arrow keys)
> Elephant
Pharmacy
Noticed this when switching back to Linux from Mac for some dev work.
Viewing the list of branches works on both devices...
$ g bs
? Select a branch: ›
❯ master
roller
t/linear-release
t/tx-view-iterate-0
origin / ja/gh-issue-template
origin / t/spawn-point-ux
... but filtering now shows [Object object]
in the results on Linux:
? Select a branch: › li
❯ [object Object]
[object Object]
[object Object]
[object Object]
[object Object]
git-branch-select: 4.0.4
Node: 14.17.0
OS: macOS 12.0.1, Ubuntu 21.04.
When list shows up alphabetically, it would be nice to type the first letter of desired branch, to quick jump to the first entry starting by that letter.
It wouldn't help in all cases (e.g. when all the branches have the same prefix!) but would still be a delight in normal usage.
How about leveraging a (optional) command-line argument to prefilter the interactive list?
$ git branch-select
? Select branch (Use arrow keys)
> Assemblyman
Amusingness
Antitruster
Antielitist
Autoclaving
$ git branch-select pha
? Select branch (Use arrow keys)
> Elephant
Pharmacy
Branches with /
in their names cause it to crash with EISDIR
as it's trying to read the commit hash from the ref file.
See #19 (comment) for details
From #5 by @Deleplace:
origin/xxx
that I've never checkouted yetFirst of all, love this tool, have been using it for years and promoting it to other developers. Thanks for your hard work!
So, the list of branches is still rendered:
But selecting fails with the aforementioned error:
Just upgraded to 3.2.2
to see if that might do the trick, but no luck.
Here is some metadata that might help, LMK if there are any other diagnostics that would be useful:
Linux computer 4.15.0-91-generic #92-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
git version 2.26.2
node v14.1.0
edit:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.