分享交流
合作共赢!

git工具基础使用方法总结

一、git基础配置

1.直接在 Shell 下执行下述:

git config –global user.name “Tsung”
git config –global user.email “username@email.com”
git config –global color.diff auto # git diff 要顯示顏色
git config –global color.status auto # git status 要顯示顏色
git config –global color.branch auto

注意: 这些设置会在 ~user/ 下产生 .gitconfig, 所以我们也可以直接编辑这个文件,如下所示

[color]     
diff = auto
status = auto
branch = auto
[user]
name = Tsung
email = username@email.com

若想配置了git的存储凭证方式可以用如下命令

$ git config --global credential.helper cache

注意:这个命令如果将参数cache改为store,会在~user/下生成一个名为.g.git-credentials文件,永久将凭证保存在此文件中。详情参考文章:git工具之存储凭证

2.快捷方式配置:

$ git config –global alias.st status

$ git config –global alias.ci commit

$ git config –global alias.df diff

$ git config –global alias.co checkout

$ git config –global alias.br branch

3. 临时性的设置的话就不要加–global 参数,比如

$ git config user.name “2”

$ git config user.email “2@g.cn”

赞(0) 打赏
未经允许不得转载:琼杰笔记 » git工具基础使用方法总结

评论 抢沙发

评论前必须登录!

 

分享交流,合作共赢!

联系我们加入QQ群

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册