美文网首页
2020-06-22 bash超级问答之git命令自动提示显示自

2020-06-22 bash超级问答之git命令自动提示显示自

作者: 五大RobertWu伍洋 | 来源:发表于2020-06-22 11:00 被阅读0次

    已为git 命令在bash下配置了命令自动提示(通过 git-completion.bash)

    示例:
    输入git,然后tab, 会显示如下内容:

     周一 2020-06-22  10:29:09  /g/Mxt10  master
    14866 $ git
    Display all 130 possibilities? (y or n)
    add            ci             dfcol          fea            lg40           pullo          rtv
    am             citool         dfff           fetch          lg80           pullodev       send-email
    apply          clean          dffl           flow           lga            push           shortlog
    archive        clone          dffl1          format-patch   lgg            pusho          show
    bash           cm             dfl            fsck           lgg2           range-diff     show-branch
    bav            cmd            dfl1           gc             lgp            rebase         ss
    bd             co             dfll           gitk           lgs            reflog         st
    bisect         commit         dfll1          grep           ll             rem            stage
    blame          config         dfls           gui            log            remote         stash
    bm             describe       dfls1          help           logall         remv           status
    br             df             dfst           hist           mer            repack         submodule
    branch         df1            diff           hists          merge          replace        tag
    brav           df1l           difftool       init           mergetool      request-pull   type
    brv            df2            dt             instaweb       mt             reset          unstage
    bundle         df2l           dt1            l              mv             ret            whatchanged
    cb             df3            dt2            last           notes          revert         worktree
    checkout       dfc            dt3            lfs            pu             rm
    cherry         dfca           dump           lg             pul            rmt
    cherry-pick    dfcache        fe             lg1            pull           rmv
    

    其中包括,git自带命令,比如add,push,branch
    同时,显示了~/.gitconfig中配置的alias别名, 比如fea,brav,lg

    [alias]
            fe = fetch
            fea = fetch --all
            pu = push
            pul = pull
            dt = difftool
            dfc = diff --color
            dfcol = diff --color
            dfcache = diff --cached
            dfca = diff --cached
            mt = mergetool
            mer = merge
            rmt = remote
            rem = remote
            rtv = remote -v
            rmv = remote -v
            remv = remote -v
            ret = reset
            co = checkout
            cb = checkout -b
            df = diff
            dfls = diff --name-status
            dfls1 = diff --name-status HEAD~1
            dfst = diff --stat
            dfll = diff --stat
            dfl = diff --stat
            df1 = diff  HEAD~1
            dt1 = dt  HEAD~1
            dt2 = dt  HEAD~2
            dt3 = dt  HEAD~3
            df2 = diff  HEAD~2
            df3 = diff  HEAD~3
            dfl1 = diff --stat HEAD~1
            df1l = diff --stat HEAD~1
            df2l = diff --stat HEAD~2
            dfll1 = diff --stat HEAD~1
            dffl = diff --name-status
            dffl1 = diff --name-status HEAD~1
            dfff = diff --name-status HEAD~1
            ci = commit
            cm = commit -m
            st = status
            ss = status
            br = branch
            bd = branch -d
            bD = branch -D
            bm = branch -m
            bav = branch -av
            brv = branch -av
            brav = branch -av
            lgs = log --color --stat
            lgp = log --color -p
            hists = log --color --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
            pullo = pull origin
        pullodev = pull origin develop
        pusho = push -u origin
            type = cat-file -t
            dump = cat-file -p
            unstage = reset HEAD
            last = log --color -1
    
    

    亲爱的看官,超级问题来了:

    bash下设置alias g=git别名后,如何让输入g后通过tab自动提示出git的命令,就像上面输入了git后自动提示的一样??

    知道答案或有任何思路的朋友,热烈欢迎留言交流哦!!

    相关文章

      网友评论

          本文标题:2020-06-22 bash超级问答之git命令自动提示显示自

          本文链接:https://www.haomeiwen.com/subject/xpcxfktx.html