zoukankan      html  css  js  c++  java
  • git 自动补全

    参考自 Quick Tip: Autocomplete Git Commands and Branch Names in Bash

    In bash in Mac OS X, you can use [TAB] to autocomplete file paths. Wouldn’t if be nice if you could do the same with git commands and branch names?

    You can. Here’s how.

    First get the git-completion.bash script (view it here) and put it in your home directory:

    curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
    

    Next, add the following lines to your .bash_profile. This tells bash to execute the git autocomplete script if it exists.

    if [ -f ~/.git-completion.bash ]; then
      . ~/.git-completion.bash
    fi
    

    Now open a new shell, cd into a git repo, and start typing a git command. You should find that [TAB] now autocompletes git commands and git branch names.

    For example, if you type git then add a space and hit [TAB], you’ll get a readout like this, which lists all available git commands:

    add                 filter-branch       reflog
    am                  format-patch        relink
    annotate            fsck                remote
    apply               gc                  repack
    archive             get-tar-commit-id   replace
    bisect              grep                request-pull
    blame               gui                 reset
    branch              help                revert
    bundle              imap-send           rm
    checkout            init                send-email
    cherry              instaweb            shortlog
    cherry-pick         log                 show
    citool              merge               show-branch
    clean               mergetool           stage
    clone               mv                  stash
    commit              name-rev            status
    config              notes               submodule
    describe            p4                  svn
    diff                pull                tag
    difftool            push                whatchanged
    
  • 相关阅读:
    滚动菜单BUG修复
    前端之滚动菜单
    数据仓库操作
    mysql之分页与慢日志以及表知识补充
    mysql之索引
    mysql之内置函数
    mysql之触发器与事务
    pymysql操作数据库之存储过程
    复习mysql语句
    经典mysql测试题
  • 原文地址:https://www.cnblogs.com/li12242/p/5041164.html
Copyright © 2011-2022 走看看