git使用手册

基本操作

初始化

git init

 

查询当前分支状态

git status

 

查看当前分支名称

git branch

 

切换分支

git checkout xxx
# 要切换的分支名称

 

拉取最新当前分支

git pull

 

创建本地分支并切换到此分支

git checkout -b develop origin/develop
# 本地 源/云分支

 

拉取自其他远程分支

# 使用pull需提前创建本地分支,fetch可直接操作
git pull origin xxx
# 首次拉取建议使用仓库地址
gti fetch https://gitee.com/ni-wendi/test.git xxx

 

分支合并

# 来到父分支
# 合并名为son的子分支
git merge son

 

解决冲突

# 选择各个冲突保留的内容后commit+push即可
git commit -m "xxx"
git push

 

本地代码提交到当前分支

1.暂存所有文件

git add .

2.提交并添加信息

git commit -m "message"

3.推送至云端同名分支

git push -u origin
git push
# 首次推送添加-u origin
# 后续使用 git push即可
posted @ 2023-06-07 13:02  LegendN  阅读(27)  评论(0编辑  收藏  举报