git的使用方法,如何配置

使用 git自从 git-1.5.4 , 'git-xyz' 这种用法就不提倡了,而推荐 'git xyz' 风格。  git 的后续版本中将在 make install时不再安装 'git-xyz' 这些 hardlinks 。当如果执行 git --exec-path 输出的目录中依然有 git-xyz 这些脚本,你还是可以把这个路径加到 PATH 环境变量中,这样还能够使用 git-xyz 形式的脚本。config   ------    我的一些简单的配置:    $ git-config user.name "Jike Song"   $ git-config user.email [email]albcamus@gmail.com[/email]   $ git-config core.editor vim   $ git-config core.pager "less -N"   $ git-config color.diff true  // 显示 diff 时色彩高亮   $ git-config alias.co checkout  // 给 git checkout 取个别名,这样只输入 git co 即可   $ git-config sendemail.smtpserver /usr/bin/msmtp     注意,这会在当前 repository 目录下的 .git/config 中写入配置信息。   如果 git-config 加了 --global    选项,配置信息就会写入到 ~/.gitconfig 文件中。   因为你可能用不同的身份参与不同的项目,而多个    项目都用 git 管理,所以建议不用 --global 配置。   $ git-val -l  // 列出 git 变量     init   ----    $ git-init-db  // 创建一个 .git/ 目录,初始化一个空的 git 仓库//这个目录在git-clone时也会创建。也就是说clone时会自动初始化git//仓库里需要的东西    clone   -----    $ git-clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git [dir name]   [dir name] 是你想让这个仓库叫什么名字。   如果不指定,就会等同于目标仓库的名字。     注意,这种 git server 形式的 repository ,都有一个 filename.git 文件;   而对于 *.git 的操作,也可以    针对 .git 所在的目录: $  mkdir tmp/$  cd tmp/$  git-clone ~/Sources/linux-2.6     或者通过 ssh : $  git-clone [email]arc@host.xyz.com[/email]:/home/arc/Sources/linux-2.6     此时当前目录下有一个 .git/ 目录 .  以下我们都在 linux-2.6/ 下演示:  使用 git自从 git-1.5.4 , 'git-xyz' 这种用法就不提倡了,而推荐 'git xyz' 风格。  git 的后续版本中将在 make install时不再安装 'git-xyz' 这些 hardlinks 。当如果执行 git --exec-path 输出的目录中依然有 git-xyz 这些脚本,你还是可以把这个路径加到 PATH 环境变量中,这样还能够使用 git-xyz 形式的脚本。config   ------    我的一些简单的配置:    $ git-config user.name "Jike Song"   $ git-config user.email [email]albcamus@gmail.com[/email]   $ git-config core.editor vim   $ git-config core.pager "less -N"   $ git-config color.diff true  // 显示 diff 时色彩高亮   $ git-config alias.co checkout  // 给 git checkout 取个别名,这样只输入 git co 即可   $ git-config sendemail.smtpserver /usr/bin/msmtp     注意,这会在当前 repository 目录下的 .git/config 中写入配置信息。   如果 git-config 加了 --global    选项,配置信息就会写入到 ~/.gitconfig 文件中。   因为你可能用不同的身份参与不同的项目,而多个    项目都用 git 管理,所以建议不用 --global 配置。   $ git-val -l  // 列出 git 变量     init   ----    $ git-init-db  // 创建一个 .git/ 目录,初始化一个空的 git 仓库//这个目录在git-clone时也会创建。也就是说clone时会自动初始化git//仓库里需要的东西    clone   -----    $ git-clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git [dir name]   [dir name] 是你想让这个仓库叫什么名字。   如果不指定,就会等同于目标仓库的名字。     注意,这种 git server 形式的 repository ,都有一个 filename.git 文件;   而对于 *.git 的操作,也可以    针对 .git 所在的目录: $  mkdir tmp/$  cd tmp/$  git-clone ~/Sources/linux-2.6     或者通过 ssh : $  git-clone [email]arc@host.xyz.com[/email]:/home/arc/Sources/linux-2.6     此时当前目录下有一个 .git/ 目录 .  以下我们都在 linux-2.6/ 下演示:    pull   ----   $ git-pull  // 更新本地的 git tree 。   如果自从你 clone 了 linus tree 之后, linus tree//有新的改动,那么把这些更改更新到你的本地tree中//类似于cvs  update  pull   ---- FYI:  git-clone 和 git-pull 都会默认调用 git-merge 。   FYI:  每天 git-pull 更新技巧:1)  git-describe ,例如目前是 v2.6.26-rc8-122)  git-pull -v3)  git-describe ,例如是 v2.6.26-rc8-224)  git-log -p -10 查看变化    diff   ----   $ git-diff  /* 列出自己本地的 tree 中已修改、但却未 commit 的改动   这也是产生 patch 的方式 ( 用来提交的 patch 需要先 commit 到自己的 tree 里,   然后 git-format-patch) 。   注意,使用 git-diff 产生的 patch 都应该在  patch(1) 时指定 -p1 ,或者直接使用 git-apply 打补丁 */    选项:     --color  diff 语法高亮 ( 可以 git-config color.diff true)     --ignore-space-at-eol   忽略行尾的 whitespace     -b     --ignore-space-change   忽略行尾的 whitespace ,并且认为所有的 whitespace 都是一样的     -w     --ignore-all-space  比较两行的时候,完全忽略 whitespace 。这样,即使是一行有很多      whitespaces ,另一行文字一样但是没有 whitespace , git 也认为这两行内容一致。   $ git-pull  // 更新本地的 git tree 。   如果自从你 clone 了 linus tree 之后, linus tree//有新的改动,那么把这些更改更新到你的本地tree中//类似于cvs  update  Internet上有很多免费的git  hosting sites ,你可以把自己的项目放在上边,以便和别人协同开发。  git 官方站点有一个页面列出了常用的站点: http://git.or.cz/gitwiki/GitHosting 其中最老的site是: http://repo.or.cz 该站点要求项目必须是*free  software* 。 另一个现在最受欢迎(没用过,看别人的评论)的是: http://github.com/ GITHUB把projects分为3种:  a) opensource projects ,免费;  b) personal projects ,收费;  c) business projects ,当然收费:) 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值