git的常用流程

如果你刚进公司第一天

git clone 项目地址
cd 项目文件夹
git pull 
// 假如使用develop分支为基准
git checkout develop
// 拉最新代码
git pull
// 开自己的分支
git checkout -b 分支名称
// 将修改的代码放入暂存区
git add .
// 提交
git commit -m '注释'
// 推送远程分支
git push origin 分支名称
// 追加修改
git commit --amend
// 强制推送
git push origin 分支名称 -f    

日常工作流程

git stash
git checkout develop
git pull -r
git checkout '自己的分支名'
git rebase -i develop
git stash pop 
git add .
git commit -m ''第一次提交
git commit --amend 非第一次提交
git push origin '分支名' 第一次提交推送
git push origin '分支名' -f 非第一次提交推送

解决冲突

git checkout develop
git pull
git checkout '自己的分支名'
git rebase -i develop
git status => 查看哪些文件冲突了
git add .
git status
git rebase --continue
git status
git commit --amend => 非第一次提交
git push origin '分支名' -f
posted @ 2022-05-10 17:37  七友の  阅读(51)  评论(0)    收藏  举报