Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux系统 > » 正文

Git学习笔记 四

来源: 未知 分享至:

这里介绍设置git使用的两个小窍门

第一:修改使git拥有unix的优良特性(自动完成)

在安装成功git后,会遗留安装目录,这个操作就是针对那个目录的操作。

[root@localhost ~]# cp  git-1.7.7.4/contrib/completion/git-completion.bash  ~./.git-completion.bash  //把这个文件复制成为用户家目录下的同名的隐藏文件

[root@localhost ~]# vi .bashrc  //加上下边的那句话

source ~/.git-completion.bash

[root@localhost ~]# source .bashrc

最后进入git的工作区域做测试

[root@localhost ~]# cd /git/status/

[root@localhost status]# git sta   //两次tab 就出现了以下的情况,巨开心吧

stage    stash    status

出现这个提示对于我们记忆大量的命令无疑是一种福音。

第二:设置git命令的别名

git commit这个命令为实例

在正常的情况下以下是一个完整的过程

[root@localhost status]# vi st1

[root@localhost status]# git add st1

[root@localhost status]# git commit -m "2nd commit"

[master 41934ca] 2nd commit

 1 files changed, 1 insertions(+), 0 deletions(-)

 create mode 100644 st1

在设置使用别名后再对比下看看

[root@localhost status]# vi st2

[root@localhost status]# git add st2

[root@localhost status]# git config --global alias.ci commit

[root@localhost status]# git ci -m "3rd commit"

[master 6a5cb99] 3rd commit

 1 files changed, 1 insertions(+), 0 deletions(-)

 create mode 100644 st2

对比下发现可以通过使用别名来简化命令啊,真是巨开心。

 

这里总结git的另个技巧和窍门,以备后用。


Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史