# 查看配置
git config --list [--local | --global |-- system]
# 设置配置
git config [--local | --global |-- system] user.name 'your name'
git config [--local | --global |-- system] user.mail 'your email'
# 删除配置
git config --unset [--local | --global |-- system] user.name
# 删除具体的一条配置信息(user.name='xxx'将被删除)
git config --unset user.name='xxx'
# 删除一组配置信息(user组的所有配置都将被删除)
git config --remove-section user
分支操作
# 查看分支
git branch
# 创建分支
git branch [分支名]
# 切换分支
git checkout [分支名]
# 创建分支后切换至新分支
git checkout -b [分支名]
# 删除分支,如果该分支有提交未合并,删除失败
git branch -d [分支名]
# 强制删除分支,如果该分支有提交未合并,删除成功
git branch -D [分支名]
新建分支并与远程分支建立关联
以从dev分支新建project01分支为例
# 切换到dev分支
git checkout dev
# 创建分支并与远程分支建立关联(拉取仓库)
git checkout -b project01 origin/project01 # 远程必须要有project01分支