Git学习笔记

118 阅读1分钟

常用命令

# 查看git用户名
git config user.name

# 查看邮箱配置
git config user.email

# 全局配置用户名
git config --global user.name "name"

# 全局配置邮箱
git config --global user.email "eamil"

# Ubuntu 设置记住密码
vim ~/.gitconfig
# 在配置文件中加入
# [credential]
#     helper = store

# 初始化仓库
git init

# 拉去克隆
git clone

# 检查状态
git status

# 查看当前仓库地址
git remote show origin

# 添加文件
git add <fileName>

# 提交记录
git commit -a -m 'message'

# 推送分支
git push origin master

# 查看分支
git branch

# 创建分支
git branch <branchName>

# 切换分支
git checkout <branchName>

# 创建并切换分支
git checkout -b <branchName>

# 合并分支到当前分支
git merge <branchName>

# 删除分支
git branch -d <branchName>