r - Rstudio 中的 Git 项目 - 从备份中恢复更改
问题描述
我有一个名为abc
git hub 的存储库。我的 Linux 笔记本电脑中有相同存储库的修改版本(较新版本)作为备份文件夹 - abc_new
.
如何在服务器abc_new
中链接abc
并将更改提交abc_new
到abc
?我想从 RStudio 做
我尝试在我的 RStudio 中使用 SSH url 创建一个新项目,所以我abc
在笔记本电脑中创建了一个新文件夹,其中包含来自abc
git 服务器的所有文件。现在我该如何abc_new
合并abc
?如果我从abc_new
to复制文件abc
并提交,它会在 github 服务器中创建为重复文件。
该项目没有分叉,只有 1 个分支到我的本地。
尝试了链接https://happygitwithr.com/existing-github-last.html中给出的步骤并得到了合并错误。
The last 2 steps `git remote add origin` and `git push` failed for me with below errors `$ git remote add origin git@domain.com:path.git
fatal: remote origin already exists.
$ git push --set-upstream origin master
To git@domain.com:path.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@domain.com:path.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
$`
解决方案
第 17.5.4 节:happygitwithr.com/existing-github-last.html。您能否使用此方法将您的 github 存储库添加为 abc_new 的远程仓库并推送更改。
推荐阅读
- django-rest-framework - 出错时返回不同的 Content-Type 响应
- c# - 查找字符串模式
- html - 根据内容自动调整面板宽度
- php - 如何显示删除的 array_unique 行?
- macos - 获得更好的基于 CPU 的 OpenCL 驱动程序 (OS X)
- python - Lambda 函数无法访问调用函数的导入?
- java - 使用 charAt 方法时出现“Stringchar 类型的方法 charAt(int) 未定义”错误
- java - 如果java中有旧的毫秒,如何计算提供的当前毫秒
- dart - 飞镖 | Flutter 包:如何更新包不允许我的开发取得进展?
- php - Composer 自动加载显示 PHP 文件的内容,而不是执行它