没有合适的资源?快使用搜索试试~ 我知道了~
git详细使用教程
资源推荐
资源详情
资源评论
[TOC]
OS X
上
安
装
git
推
荐
brew
安
装
:
brew install git --with-gettext
--with-gettext
有
中
⽂
语⾔
包
执
⾏
brew info git
查
看
git
安
装
信
息
如
下:
00:19 $ brew info git
git: stable 2.13.2 (bottled), HEAD
Distributed revision control system
https://git-scm.com
/usr/local/Cellar/git/2.12.2 (1,466 files, 36.8MB) *
Built from source on 2017-03-28 at 17:53:06 with: --with-gettext
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/git.rb
==> Dependencies
Optional: pcre ✔, gettext ✔, openssl ✘, curl ✘
==> Requirements
Optional: perl >= 5.6 ✔
==> Options
--with-blk-sha1
Compile with the block-optimized SHA1 implementation
--with-curl
Use Homebrew's version of cURL library
--with-gettext
Build with gettext support
--with-openssl
Build with Homebrew's OpenSSL instead of using CommonCrypto
--with-pcre
Build with pcre support
--with-perl
Build against a custom Perl rather than system default
--with-persistent-https
Build git-remote-persistent-https from 'contrib' directory
--with-subversion
Use Homebrew's version of SVN
--without-completions
Disable bash/zsh completions from 'contrib' directory
--HEAD
Git
使
⽤
规
范
安
装
OS X
上
安
装
git
Install HEAD version
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/git
在
Caveats
(
附
加
说
明
)
⾥
提
示
git
⾃
动
补
全
相
关
的
⽂
件
已安
装
。
怎
么
实
现
git
命
令
⾏
⾃
动
补
全
呢
?
如
果
⽤
的
是
bash
,
需
要
安
装
bash-completion
,
如
果
⽤
的
是
zsh
,
需
要
安
装
zsh-completion
安
装
完
成
之
后
根
据
附
加
说
明
的
提
示
,
修
改
.bash_profile
⽂
件
,
执
⾏
source .bash_profile
后即
可
。
有
没
有
办
法
能
直
观
的
显
示
当
前分
⽀
、
当
前
状
态
呢
?
答
案是有
的
,
那
就
是
bash-git-prompt
# bash 4.1
以
上
的
版
本
使
⽤
bash-completion@2
00:14 $ brew install bash-completion@2
==> Downloading https://homebrew.bintray.com/bottles/bash-completion@2-2.7.sierra.bo
######################################################################## 100.0%
==> Pouring bash-completion@2-2.7.sierra.bottle.tar.gz
==> Using the sandbox
==> Caveats
Add the following to your ~/.bash_profile:
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
fi
==> Summary
🍺
/usr/local/Cellar/bash-completion@2/2.7: 648 files, 909.2KB
brew install bash-git-prompt
==> Downloading https://github.com/magicmonty/bash-git-prompt/archive/2.6.2.tar.gz
==> Downloading from https://codeload.github.com/magicmonty/bash-git-prompt/tar.gz/2
######################################################################## 100.0%
==> Caveats
You should add the following to your .bashrc (or equivalent):
if [ -f "/usr/local/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR="/usr/local/opt/bash-git-prompt/share"
source "/usr/local/opt/bash-git-prompt/share/gitprompt.sh"
fi
==> Summary
🍺
/usr/local/Cellar/bash-git-prompt/2.6.2: 40 files, 94.4KB, built in 7 seconds
安
装
bash-completion
安
装
bash-git-prompt
安
装
Caveats
说
明
,
修
改
.bashrc
⽂
件
(
Linux
上
是
.bashrc
⽂
件
,
OS X
上
是
.bash_profile
⽂
件
),
执
⾏
source .bash_profile
后即可
。
附
上
我
的
.bash_profile
配
置
附
上
我
的
.gitconfig
配
置
Windows
电
脑
使
⽤
git
命
令
⾏
⼯
具
,
推
荐
cmder
,下
载
安
装
完
整
版
,
带
有
git
及
Unix
命
令
。
cmder
显
示
中
⽂
乱
码
及
vi
编
辑
时
中
⽂
乱
码
问题
,
⾃
⾏
百
度
之
~
# Automatically trim long paths in the prompt (requires Bash 4.x)
PROMPT_DIRTRIM=2
export PS1="\[\e[34m\][\[\e[m\]\[\e[34m\]\w\[\e[m\]\[\e[34m\]]\[\e[m\]\[\e[35m\]\\$\
export CLICOLOR=1
export LSCOLORS=gxfxaxdxcxegedabagacad
#export PS1='\[\033[01;34m\][\W]\$\[\033[00m\] '
#
⾃
动
补
全
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
fi
# bash-git-prompt
if [ -f "/usr/local/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR="/usr/local/opt/bash-git-prompt/share"
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_FETCH_REMOTE_STATUS=1
# GIT_PROMPT_SHOW_UPSTREAM=1
GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all;
GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=1
source "/usr/local/opt/bash-git-prompt/share/gitprompt.sh"
fi
[user]
name = liuxg
email = liuxingguo@139.com
[core]
excludesfile = /Users/liuxg/.gitignore_global
quotepath = false
autocrlf = input
safecrlf = false
[push]
default = simple
[log]
date = iso8601
[alias]
logm = log --oneline --graph --decorate
history = log --graph --pretty=format:\"%C(auto)%h %d %s %C(blue normal bold)<%C
Windows
上
安
装
git
⼀
般
在
新
的
系统
上,
我
们
都
需
要
先
配
置
下
⾃
⼰
的
Git
⼯
作
环
境
。
配
置
⼯
作
只
需
⼀
次
,
以
后升
级
时
还
会
沿
⽤现
在
的
配
置
。
当
然
,
如
果
需
要
,
你
随
时
可
以
⽤
相
同
的
命
令修
改
已
有
的
配
置
。
Git
提
供了
git config
命
令
,专
⻔
⽤
来
配
置
或
读
取
相
应
的
⼯
作
环
境
变
量
。
⽽
正
是
由
这
些
环
境
变
量
,
决
定
了
Git
在
各
个
环
节
的
具
体
⼯
作
⽅
式
和
⾏
为
。
这
些
变
量
可
以
存
放
在
以
下三个不
同
的
地
⽅
:
/etc/gitconfig
⽂
件
:
系统
中
对
所
有
⽤
户
都
普
遍适
⽤
的
配
置
。
若
使
⽤
git config
时
⽤
--system
选
项
,
读
写
的
就
是
这
个
⽂
件
。
~/.gitconfig
⽂
件
:
⽤
户
⽬
录
下
的
配
置
⽂
件
只
适
⽤
于
该
⽤
户
。
若
使
⽤
git config
时
⽤
--global
选
项
,
读
写
的
就
是
这
个
⽂
件
。
当
前
项
⽬的
Git
⽬
录
中
的
配
置
⽂
件
(
也
就
是
⼯
作
⽬
录
中
的
.git/config
⽂
件
):
这
⾥
的
配
置
仅仅
针
对
当
前
项
⽬
有
效
。
每
⼀个
级
别
的
配
置
都
会
覆
盖
上
层
的相
同
配
置
,
所
以
.git/config
⾥
的
配
置
会
覆
盖
/etc/gitconfig
中
的
同
名变
量
。
在
Windows
系统
上,
Git
会
找
寻
⽤
户
主
⽬
录
下
的
.gitconfig
⽂
件
。
主
⽬
录
即
$HOME
变
量
指
定
的⽬
录
,⼀
般
都
是
C:\Documents and Settings\$USER
。
此
外
,
Git
还
会
尝
试
找
寻
/etc/gitconfig
⽂
件
,
只
不
过
看
当
初
Git
装
在
什么
⽬
录
,
就
以
此
作为
根
⽬
录
来
定
位
。
第
⼀个
要
配
置
的
是
你
个
⼈
的
⽤
户
名
称
和
电
⼦
邮
件
地址
。
这
两
条
配
置
很
重
要
,
每次
Git
提
交
时
都
会
引
⽤
这
两
条
信
息
,
说
明是
谁
提
交了
更
新
,
所
以会
随
更
新
内
容
⼀
起
被
永
久
纳
⼊
历史
记
录
:
git config --global user.name "liuxg"
git config --global user.email "liuxingguo@139.com"
git config --global push.default simple
Git 1.x
默
认
是
push.default=matching
,
其
意
是
如
果
你
执
⾏
git push
但
没
有
指
定
分
⽀
,
它将
push
所
有
你
本
地
的
分
⽀
到
远
程
仓
库
中
对
应
匹
配
的
分
⽀
。
⽽
Git 2.x
默
认
是
push.default=simple
,
意
思
是
执
⾏
git push
没
有
指
定
分
⽀
时
,
只
有
当
前分
⽀
会
被
push
到
对
应
匹
配
的
远
程
分
⽀
。
# windows
系统
设
置
换
⾏
符
转
换
,
提
交
是
CRLF
转
换
为
LF
,
检
出
时
LF
转
换
为
CRLF
git config --global core.autocrlf true
# OS X
系统
设
置
提
交
时
转
换
,
提
交
时
CRLF
转
换
为
LF
,
检
出
时
保
留
LF
不
转
换
git config --global core.autocrlf input
配
置
⽤
户
信
息
⾏
为
配
置
剩余15页未读,继续阅读
资源评论
Adger_mi
- 粉丝: 216
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功