一、Removing sensitive data from a repository
四、git基于remote代码强行覆盖本地代码
1.从远程拉取并更新代码库
git fetch --all
2.以远程代码为准,同步本地代码,hard强制的意思,Branch_Name为需要同步的分支名
git reset --hard Branch_Name
3.如果第二步没有生效,执行
git pull
五、git删除分支
1. 删除远端分支
git push origin -d Branch_Name
2.删除本地分支
1)切换至不被删除的其他分支
git checkout CIRRUS-4827
2)开始删除
git branch -D Branch_Name
六、解决分支合并冲突
~cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933)
$ git checkout main
~cirrus-kevin-test-ms (main)
$ git pull
~cirrus-kevin-test-ms (main)
$ git checkout -
~cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933)
$ git merge main
Auto-merging Jenkinsfile
CONFLICT (content): Merge conflict in Jenkinsfile
Auto-merging VERSION
CONFLICT (content): Merge conflict in VERSION
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
Automatic merge failed; fix conflicts and then commit the result.
~/cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933|MERGING)
$ git checkout . --theirs # 解决冲突:以main分支为主,修改usr/kevin/CIRRUS-5933分支冲突内容
Updated 3 paths from the index
~cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933|MERGING)
$ git checkout . --ours # 解决冲突:以usr/kevin/CIRRUS-5933分支为主,修改main分支冲突内容
~cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933|MERGING)
$ git status
~cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933|MERGING)
$ git add ./
~cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933|MERGING)
$ git commit -m "test"
~cirrus-kevin-test-ms (usr/kevin/CIRRUS-5933|MERGING)
$ git push origin usr/kevin/CIRRUS-5933
评论前必须登录!
注册