zoukankan      html  css  js  c++  java
  • 【版本管理】自定义git

    Git除了可配置user.name和user.email外,实际上,Git还有很多可配置项。

    $ git config --global color.ui true,让Git显⽰示颜⾊色,会让命令输出看起来更醒目。 

    忽略特殊文件:

    在Git工作区的根目录下创建一 个特殊的.gitignore文件,然后把要忽略的文件名填进去,Git就会自动忽略这些⽂文件。

    不需要从头写.gitignore文件,GitHub已经为我们准备了各种配置文件,只需要组合一下就 可以使用了。

    所有配置文件可以直接在线浏览:https://github.com/github/gitignore 

    把.gitignore也提交到Git,就完成了!当然检验.gitignore的标准是git status 命令是不是说“working directory clean”。 

    配置别名:

    有没有经常敲错命令?比如git status?status这个单词真心不好记。

    如果敲git st就表示git status那就简单多了,当然这种偷懒的办法我们是极力赞成的。

    我们只需要敲一行命令,告诉Git,以后st就表示status: $ git config --global alias.st status

    --global参数是全局参数,也就是这些命令在这台电脑的所有Git仓库下都有用。

    我们知道,命令git reset HEAD file可以把暂存区的修改撤销掉 (unstage),重新放回⼯工作区。

    既然是一个unstage操作,就可以配置一个unstage别 名: $ git config --global alias.unstage 'reset HEAD'

    当你敲入命令: $ git unstage test.py 实际上Git执行的是: $ git reset HEAD test.py

    配置一个git last,让其显示后一次提交信息: $ git config --global alias.last 'log -1'

    这样,用git last就能显示近一次的提交。

    奇淫技巧:甚至还有人丧心病狂地把lg配置成了: $ git config --global alias.lg "log --color --graph -pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" 。

  • 相关阅读:
    IE 8兼容:<meta http-equiv="X-UA-Compatible" content="IE=edge" /> X-UA-Compatible的解释
    点击下载,下载图片
    修改输入框placeholder文字默认颜色-webkit-input-placeholder
    rest_framework目录
    Django目录
    python基础内容目录
    hadoop伪分布式搭建
    通过ldap验证svn服务
    LDAP目录服务
    Python基础之字符串拼接简单介绍
  • 原文地址:https://www.cnblogs.com/zachary93/p/6137933.html
Copyright © 2011-2022 走看看