1.常用命令

1.1 克隆仓库

git clone <repository_url>

1.2 查看状态

git status

1.3 添加文件到暂存区

git add <file_name>

1.4 提交更改

git commit -m "commit message"

1.5 推送到远程仓库

git push origin <branch_name>

1.6 拉取远程仓库的更改

git pull origin <branch_name>

1.7 创建分支

git branch <branch_name>

1.8 切换分支

git checkout <branch_name>

1.9 合并分支

git merge <branch_name>

1.10 查看提交历史

git log

1.11 删除分支

git branch -d <branch_name>

1.12 查看远程仓库

git remote -v

1.13 添加远程仓库

git remote add <remote_name> <repository_url>

1.14 删除远程仓库

git remote remove <remote_name>

1.15 查看分支

git branch

1.16 查看远程分支

git branch -r

1.17 查看所有分支

git branch -a

1.18 重命名分支

git branch -m <old_branch_name> <new_branch_name>