初始化
- 设置仓库名字&邮箱 (–global选项表示全局)
git config --global user.name xxgit config --global user.email [email protected] - 配置相关
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21[user]
name = xx
email = xx
[credential]
helper = manager-core
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[pager]
branch = false
[core]
pager =
quotepath = false
[color]
ui = auto
pager = false
[gui]
encoding = utf-8
[i18n]
commitencoding = utf-8
logoutputencoding = utf-8
版本控制
本地仓库控制
git init - 为目录添加本地 .git 管理git add readme.txt - 添加 readme.txt 到暂存区git add *.txt - 添加 *.txt 到暂存区git add . - 添加包含子目录的所有到暂存区git commit -a -m "test all commit" - 提交所有暂存区修改git commit -m 'test one commit' readme.txt - 单个提交git commit -C HEAD -a --amend - 追加提交git status - 查看仓库当前状态git checkout head xx.txt - 撤销还没有到暂存区的修改git reset head <filename> - 撤销已经到暂存区的修改git reset --hard HEAD^ - 回退版本git reset --hard 1094a - 回退到指定版本
远端仓库控制
git push origin --delete test - 删除origin远端test分支