Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jiMuBao/b4c24dffe6533c6a1dc92e4465feb29f to your computer and use it in GitHub Desktop.

Select an option

Save jiMuBao/b4c24dffe6533c6a1dc92e4465feb29f to your computer and use it in GitHub Desktop.

Revisions

  1. @mmrko mmrko revised this gist Dec 8, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-zsh-checkout-autocomplete-local-only.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ```bash
    git config --global alias.checkoutr checkout
    nano /usr/local/share/zsh/site-functions/git-completion.bash
    $EDITOR /usr/local/share/zsh/site-functions/git-completion.bash
    ```
    ...and then modify the file as follows...
    ```diff
  2. @mmrko mmrko revised this gist Oct 25, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions git-zsh-checkout-autocomplete-local-only.md
    Original 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.
  3. @mmrko mmrko revised this gist Jul 4, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-zsh-checkout-autocomplete-local-only.md
    Original 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.
    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.
  4. @mmrko mmrko revised this gist Apr 18, 2016. No changes.
  5. @mmrko mmrko revised this gist Apr 18, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-zsh-checkout-autocomplete-local-only.md
    Original 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.
    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.
  6. @mmrko mmrko revised this gist Apr 18, 2016. No changes.
  7. @mmrko mmrko revised this gist Apr 18, 2016. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions git-zsh-checkout-autocomplete-local-only.md
    Original 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
    -__gitcomp_nl "$(__git_refs '' $track)"
    ```
    ```

    Use `git checkoutr` for the default behavior and `git checkout` for browsing only local branches.
  8. @mmrko mmrko revised this gist Apr 18, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions git-zsh-checkout-autocomplete-local-only.md
    Original 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
    ```bash
    ```diff
    ```

    ```diff
    +if [ "$command" = "checkoutr" ]; then
    + __gitcomp_nl "$(__git_refs '' $track)"
    +else
  9. @mmrko mmrko revised this gist Apr 18, 2016. 1 changed file with 9 additions and 3 deletions.
    12 changes: 9 additions & 3 deletions git-zsh-checkout-autocomplete-local-only.md
    Original 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
    -changed
    +added

    +if [ "$command" = "checkoutr" ]; then
    + __gitcomp_nl "$(__git_refs '' $track)"
    +else
    + __gitcomp_nl "$(__git_heads '' $track)"
    +fi
    -__gitcomp_nl "$(__git_refs '' $track)"
    ```
  10. @mmrko mmrko revised this gist Apr 18, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions git-zsh-checkout-autocomplete-local-only.md
    Original 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

    ```bash
    --- changed
    +++ added
    ```diff
    -changed
    +added
    ```
  11. @mmrko mmrko created this gist Apr 18, 2016.
    7 changes: 7 additions & 0 deletions git-zsh-checkout-autocomplete-local-only.md
    Original 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
    ```