分享交流
合作共赢!

Git笔记

一、Removing sensitive data from a repository

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository

二、通过密钥访问Github

三、Git之rebase命令使用方法总结

四、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

赞(0) 打赏
未经允许不得转载:琼杰笔记 » Git笔记
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!

 

分享交流,合作共赢!

联系我们加入QQ群

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏