MAC下Git的安装与命令行设置

一、Mac安装Git
有多种安装方式,安装更新的版本,可以使用二进制安装程序;
官方维护的 OSX Git安装程序可以在Git官方网站下载;
网址为 http://git-scm.com/download/mac;
安装时请仔细阅读安装包中的README.TXT文档。


二、Git中文手册
https://git-scm.com/book/zh/v2


三、Bash中Git自动补全功能与命令提示符配置
3.1.下载git Shell插件,下载链接:
https://github.com/git/git
解压压缩包,进入contrib/completion文件夹,其中
git-completion.bash
git-prompt.sh
两个文件主要是在git 输入命令时可以自动完成及有内容提示,防止输入命令出错

3.2.把上面这两个文件拷贝到当前用户home目录下
cp git-completion.bash ~/.git-completion.bash
cp git-prompt.sh ~/.git-prompt.sh

3.3.修改.bash_profile
vim .bash_profile
输入以下内容
# copy contrib/copmletion/git-completion.bash to your home directory and source it
# Linux users should add the line below to your .bashrc
. ~/git-completion.bash

#copy contrib/completion/git-prompt.sh to your home directory and source it
#Linux users should add the line below to your .bashrc
. ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# export PS1='\w$(__git_ps1 " (%s)")\$'
export PS1='\u:\W$(__git_ps1 " (%s)")\$ '

\w 表示打印当前工作目录,\$ 打印 $ 部分的提示符(prompt),__git_ps1 " (%s)" 表示通过格式化参数符(%s)调用`git-prompt.sh`脚本中提供的函数。 因为有了这个自定义提示符,现在你的 Bash 提示符(prompt)在 Git 仓库的任何子目录中都将显示成这样:

保存退出并source 一下.bash_profile

 

四、可视化客户端SourceTree安装

下载链接:https://www.sourcetreeapp.com

默认安装即可。

转载于:https://www.cnblogs.com/ileveli/p/6838712.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值