【Mac】增加git自动提示

参考地址:
https://gist.github.com/johngibb/972430

将如下内容保存成 install-git-completion.sh 文件,加入执行权限后执行

URL="https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash"


PROFILE="$HOME/.profile"

echo "Downloading git-completion..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
    echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi

SOURCE_LINE="source ~/.git-completion.bash"


if [[ -f "$PROFILE" ]] && grep -q "$SOURCE_LINE" "$PROFILE"; then
    echo "Already added to bash profile."
else
    echo "Adding to bash profile..."
    echo "$SOURCE_LINE" >> "$PROFILE"
fi

echo "Reloading bash profile..."
source "$PROFILE"

echo
echo "Successfully installed."
echo "Git auto-completion should be all set!"
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,602评论 25 708
  • 我试图用我的经历, 去体会你的心情。 雨落下,就能马上忘记, 阳光洒落,就能瞬间记起你。 如若这辈子不能再看到你,...
    hi简小一阅读 222评论 0 0
  • 亲爱的你,或许我们现在没什么联系,但请相信我从未将你忘记。若多年后能在某个街角相逢,还望你能将我一眼认出,...
    学羽阅读 384评论 0 1