Forked from mmrko/git-zsh-checkout-autocomplete-local-only.md
Created
October 18, 2017 02:44
-
-
Save jiMuBao/b4c24dffe6533c6a1dc92e4465feb29f to your computer and use it in GitHub Desktop.
Revisions
-
mmrko revised this gist
Dec 8, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ```bash git config --global alias.checkoutr checkout $EDITOR /usr/local/share/zsh/site-functions/git-completion.bash ``` ...and then modify the file as follows... ```diff -
mmrko revised this gist
Oct 25, 2016 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,6 @@ nano /usr/local/share/zsh/site-functions/git-completion.bash +fi ``` ... and source your shell (`source ~/.bashrc` / `source ~/.zshrc`...). Use `git checkoutr` for the default behavior and `git checkout` (or just `gco`) for browsing only local branches. Credits to http://cmetcalfe.ca/blog/git-checkout-autocomplete-local-branches-only.html. -
mmrko revised this gist
Jul 4, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,4 @@ nano /usr/local/share/zsh/site-functions/git-completion.bash +fi ``` Use `git checkoutr` for the default behavior and `git checkout` (or just `gco`) for browsing only local branches. Credits to http://cmetcalfe.ca/blog/git-checkout-autocomplete-local-branches-only.html. -
mmrko revised this gist
Apr 18, 2016 . No changes.There are no files selected for viewing
-
mmrko revised this gist
Apr 18, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,4 @@ nano /usr/local/share/zsh/site-functions/git-completion.bash +fi ``` Use `git checkoutr` for the default behavior and `git checkout` for browsing only local branches. Credits to http://cmetcalfe.ca/blog/git-checkout-autocomplete-local-branches-only.html. -
mmrko revised this gist
Apr 18, 2016 . No changes.There are no files selected for viewing
-
mmrko revised this gist
Apr 18, 2016 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,12 +2,14 @@ git config --global alias.checkoutr checkout nano /usr/local/share/zsh/site-functions/git-completion.bash ``` ...and then modify the file as follows... ```diff -__gitcomp_nl "$(__git_refs '' $track)" +if [ "$command" = "checkoutr" ]; then + __gitcomp_nl "$(__git_refs '' $track)" +else + __gitcomp_nl "$(__git_heads '' $track)" +fi ``` Use `git checkoutr` for the default behavior and `git checkout` for browsing only local branches. -
mmrko revised this gist
Apr 18, 2016 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,9 @@ ```bash git config --global alias.checkoutr checkout nano /usr/local/share/zsh/site-functions/git-completion.bash ``` ```diff +if [ "$command" = "checkoutr" ]; then + __gitcomp_nl "$(__git_refs '' $track)" +else -
mmrko revised this gist
Apr 18, 2016 . 1 changed file with 9 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,13 @@ ```bash git config --global alias.checkoutr checkout nano /usr/local/share/zsh/site-functions/git-completion.bash ```bash ```diff +if [ "$command" = "checkoutr" ]; then + __gitcomp_nl "$(__git_refs '' $track)" +else + __gitcomp_nl "$(__git_heads '' $track)" +fi -__gitcomp_nl "$(__git_refs '' $track)" ``` -
mmrko revised this gist
Apr 18, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ git config --global alias.checkoutr checkout nano /usr/local/share/zsh/site-functions/git-completion.bash ```diff -changed +added ``` -
mmrko created this gist
Apr 18, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ git config --global alias.checkoutr checkout nano /usr/local/share/zsh/site-functions/git-completion.bash ```bash --- changed +++ added ```