Now we’ll plug the git completion script into bash by pointing to it from ~/.bash_profile. For those who are curious about the /usr/local/etc/bash_completion.d/ directory: it’s for storing new completion commands, and you may have to create it if it doesn’t already exist on your machine.Īt this point the git-completion.bash script should exist on your local machine in the /usr/local/etc/bash_completion.d/ directory. A quick sudo cp /current/path/to/your/git-completion.bash /usr/local/etc/bash_completion.d/git-completion.bash should do the trick. If the git-completion.bash script exists on your machine, but is not in the /usr/local/etc/bash_completion.d/ directory, we should create a copy of it in that directory. If the git-completion.bash script doesn’t exist on your machine, please retrieve it from the link I provided above (which is this) and save it to your local machine in a new file called git-completion.bash in the /usr/local/etc/bash_completion.d/ directory. But most likely you will not need the additional steps.īy far, the best reference I've found to solve this very issue is on SpinDance, by Connor Livingston: zshrc but also give you advice on additional actions that might be necessary, like force rebuilding zcompdump. It will instruct you not only to add code to. When installation has finished, read the output of the installation script. if type brew &>/dev/null thenįPATH=$(brew -prefix)/share/zsh-completions:$FPATH Note: The output of the above installation script will tell you exactly what code to add, so read that carefully and copy from there in case it has been updated since my writing here. You may have to create that file in your user folder if it does not already exist. To activate autocompletion you then need to add a small block of code to your ~/.zshrc. Here is how to install them with Homebrew: brew install zsh-completionsīrew's zsh-completion does in fact include git-completion. So you will need specific autocomplete scripts for zsh. MacOs changed from bash to zsh as default shell starting with Catalina. Git autocompletion on Catalina and newer (using Homebrew) u means the user that owns the file, by default its creator, i.e.chmod is the command that modifies file permissions.P.s.: If this doesn't work off the bat, you may need to run chmod u+x ~/.git-completion.bash to grant yourself the necessary permission: Now git Tab (actually it's git Tab Tab ) works like a charm! This still works on both Ubuntu and OSX and on machines without the script. Note: $_ means the last argument to the previous command. bashrc file, in this case I now use: test -f ~/.git-completion.bash &. Update: I'm making these bits of code more concise to shrink down my. Then I added to my ~/.bash_profile file the following 'execute if it exists' code: if then No need to worry about what directory you're in when you run this as your home directory( ~) is used with the target. I got that from this url using the following command in the Terminal app: curl -o ~/.git-completion.bash Ok, so I needed the git autocompletion script.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |