Questions tagged [git-completion]

Git completion provides support for auto completing git commands.

Git completion routines provide support for completing:

  • local and remote branch names
  • local and remote tag names
  • .git/remotes file names
  • git 'subcommands'
  • tree paths within 'ref:path/to/file' expressions
  • file paths within current working directory and index
  • common --long-options
11 questions
6
votes
1 answer

Need help loading a git-completion.bash file

I am new to git. Every time I try loading my git-completion.bash I got the following error message line 1: syntax error near unexpected token `newline' -bash: git-completion.bash: line 1: `' Does anyone know how to solve this…
Eldan Shkolnikov
  • 391
  • 1
  • 3
  • 13
4
votes
1 answer

git auto-complete doesn't prompt branch names

I tried all that mentioned in this thread, still when I double tap tab key for command git checkout I get only following suggestions FETCH_HEAD HEAD ORIG_HEAD whereas I am expecting branch names. Any other suggestion to get this…
Kishor Pawar
  • 2,984
  • 3
  • 21
  • 46
3
votes
3 answers

Unable to find a substitute command for Bash's complete in Zsh

I put the newest git-completion.bash to my .zshrc and I get /Users/Masi/bin/shells/git/git-completion.bash:2116: command not found: complete /Users/Masi/bin/shells/git/git-completion.bash:2118: command not found: complete The lines are complete -o…
Léo Léopold Hertz 준영
  • 119,377
  • 159
  • 417
  • 655
2
votes
1 answer

bash completion for git custom subcommands?

Say I have a git-cc executable in PATH. If git-cc supports --help, then it is easy to provide adequate completion with complete -F _longopt git-cc This makes $ git-cc -- complete (as per help output). But git cc -- won't complete (even…
usretc
  • 469
  • 1
  • 7
2
votes
1 answer

How to create completion for `git flow feature checkout` alias?

I have configured my .bash_aliases like: alias gc="git checkout" alias gcf="git flow feature checkout" source ~/.git-completion.bash __git_complete gc _git_checkout source ~/.git-flow-completion.bash __git_complete gcf __git_flow_feature But when…
Eugen Konkov
  • 15,716
  • 7
  • 69
  • 107
2
votes
2 answers

alias g='git' and have bash completion still work

For an alias to git itself, eg. alias g=git, you'll find your answer more easily here. For git subcommand aliases, eg. alias gco = "git checkout", look here. I type git far too often, so I've aliased it: alias g='git' However, now I can't do: g…
Tom Hale
  • 25,410
  • 16
  • 132
  • 172
1
vote
0 answers

Git tab complete showing all Git command history

My tab complete for the git command shows the history of all git commands I've run. I'm stumped on this one, and haven't found anything online that's helped me resolve this. Maybe I'm just using the wrong terms for the issue. I was switching windows…
Andy Berzley
  • 36
  • 1
  • 2
1
vote
1 answer

git completion on zsh not listing ambiguous options (on macOS)

My machine is a M1 Mac mini running Big Sur. I am trying to get git completion to work in the default terminal which uses a zsh shell. This is what I am trying and expecting. Screenshot below. I am able to get completion to work, but not exactly as…
indojin
  • 79
  • 4
1
vote
1 answer

How does git-completion call the function related to the command you're typing?

I'm trying to look at the code of git-completion.bash. If you run this file, you can auto complete git command arguments. I want to write a very similar tool, but for another command (ie: not git). I'm trying to figure out how this works so I can…
Daniel Kaplan
  • 54,448
  • 39
  • 189
  • 282
0
votes
1 answer

How can I debug ZSH completion for git on macos

I switched to zsh when I upgraded to Catalina and have been generally very happy, especially with how many completions just work without any work on my part. But sometime in the last week or so, completions stopped working. It had been working…
Marvin
  • 1,590
  • 12
  • 22
0
votes
1 answer

Open gnome terminal new tab in current folder with git prompt command

In Fedora 29, added nice branch display to my bash prompt and new tabs no longer open in current folder: if [ -f /etc/bash_completion.d/git-prompt ] then GIT_PS1_SHOWCOLORHINTS='yes' GIT_PS1_SHOWDIRTYSTAT='yes' GIT_PS1_SHOWSTASHSTATE='yes' …
kornieff
  • 2,021
  • 15
  • 27