罪恶克星 发表于 2024-6-14 23:26:16

idea已设置的git堆栈地点 更换新的Git堆栈地点 教程

文章目录



[*] 目录
文章目录
更改流程
小结
   

[*]概要
[*]更改流程
[*]技能细节
[*]小结


概要
先在idea控制台走一下游程
https://img-blog.csdnimg.cn/direct/53e4129a788b402494ff58e384e7bafd.png
https://img-blog.csdnimg.cn/direct/656772196cb8422d89ad211725119477.png
https://img-blog.csdnimg.cn/direct/c92110835bab4b17a61fac67e331a796.png
先将本地的git堆栈删除
1. 查看当前远程堆栈地点:
在终端或命令行中,导航到你的项目目录,并运行以下命令查看当前的远程堆栈地点:
git remote -v 2. 移除远程堆栈地点:

如果你想要完全移除远程堆栈的地点,可以运行以下命令:
git remote remove <remote_name> 其中,<remote_name> 是你想要移除的远程堆栈的名称。通常,远程堆栈的默认名称是 origin。
比方,如果要移除名为 origin 的远程堆栈,可以运行:
git remote remove origin
[*] 3 验证移除效果:
[*] 可以再次运行 git remote -v 命令来验证远程堆栈地点是否已经被移除。
3. 拉取远程堆栈的更新:起首,实行git pull命令,将远程堆栈的更新合并到你的本地堆栈中。
git pull origin master 1. 解决报错题目

To https://gitee.com/xzali/xxxxx.git
!       master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/xzali/xxxxx.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 要解决这个题目,你可以在实行 git pull 命令时,添加 --allow-unrelated-histories 参数,以允许合并不相关的历史。
git pull origin master --allow-unrelated-histories 这会将远程堆栈的更新合并到你的本地堆栈中,纵然它们没有共同的历史。完成合并后,你应该能够正常地推送你的更改到远程堆栈中。
git push origin master 运行乐成的信息

From https://gitee.com/xzali/xxxx
* branch            master   -> FETCH_HEAD
Merge made by the 'recursive' strategy.
README.en.md | 36 ++++++++++++++++++++++++++++++++++++
README.md    | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 73 insertions(+)
create mode 100644 README.en.md
create mode 100644 README.md 更改idea工具流程

https://img-blog.csdnimg.cn/direct/32afe4dcaacd49b0930788741eed6868.png
https://img-blog.csdnimg.cn/direct/eae7453466a8413bb7804a4116aeab3a.png
技能细节
点击push提交到远程堆栈地点
https://img-blog.csdnimg.cn/direct/89ff64dea3b8421c8cf744fca21dd9c9.png
小结

解决最后一个题目,当前的本地分支是dev切换分支报错,而且导致提交不到远程堆栈master
报错题目
https://img-blog.csdnimg.cn/direct/166d9c8bbef14387bea3a6de57454c8d.png
这个错误提示表明在切换分支时,有未跟踪的工作树文件会被检出的分支覆盖。为了解决这个题目,你可以实行以下步骤之一:

[*] 提交或者移除未跟踪的文件:如果这些文件对你的项目没有影响,可以通过将它们提交到当前分支或者移除它们来解决辩论。

[*] 如果你想保留这些文件,可以将它们添加到暂存区并提交:

git add README.en.md README.md
git commit -m "Committing untracked files before switching branches" https://img-blog.csdnimg.cn/direct/a25bcfd32c7b47b694793d78318cfcad.png


[*] 如果这些文件对你的项目没有效处,可以将它们删除:
git rm README.en.md README.md 2. 暂时存储未跟踪的文件:如果你不想提交或者删除这些文件,可以使用 git stash 命令将它们暂时存储起来,然后再切换分支。
git stash push -u
[*] https://img-blog.csdnimg.cn/direct/547ddbc1d33941d382778eb979dbb6e0.png
现在就可以切换到master分支了,如下操纵步骤
https://img-blog.csdnimg.cn/direct/df99dce0a57a483fa6ddcf6206567508.png
切换到master
https://img-blog.csdnimg.cn/direct/105aa23bbf5d4758a4e3cd8dc1609350.png
切换乐成
https://img-blog.csdnimg.cn/direct/a6539bb54e6d4c5b82aab49b06661dcb.png
点击push提交上去
https://img-blog.csdnimg.cn/direct/06a65d9e62de492b92e50d1824320348.png
2. 报错题目解决

提交到远程堆栈,照旧有报错信息,这个题目在上面已有讲解《1. 报错题目解决》标题请上滑查看解决报错   
实行1. 报错题目解决,2.再实行小结的命令
切换分支哪里需要再操纵,现在分支就是在master分支提交到远程堆栈报错题目解决
这个错误提示表明推送操纵被拒绝,由于远程堆栈的 master 分支比你本地的 master 分支超前。这通常发生在你试图推送到一个已经包含了你本地没有的提交的分支。
https://img-blog.csdnimg.cn/direct/17788886108c43fcb83b9de977a8880f.png


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: idea已设置的git堆栈地点 更换新的Git堆栈地点 教程