Skip to content

Instantly share code, notes, and snippets.

@whut
whut / git_checkout.lua
Last active October 29, 2015 10:55 — forked from sweiss3/git_checkout.lua
A clink script for supporting tab-completion of git branches when using "git checkout"
-- copy&pasted the code to support not only git checkout but also git merge
function git_checkout_match_generator(text, first, last)
found_matches = false;
if rl_state.line_buffer:find("^git checkout ") then
has_start_branch = not rl_state.line_buffer:find("^git checkout[ ]*$")
for line in io.popen("git branch 2>nul"):lines() do
local m = line:match("[%* ] (.+)$")
if m then