首页 > 解决方案 > Rstudio 中的 Git 项目 - 从备份中恢复更改

问题描述

我有一个名为abcgit hub 的存储库。我的 Linux 笔记本电脑中有相同存储库的修改版本(较新版本)作为备份文件夹 - abc_new.

如何在服务器abc_new中链接abc并将更改提交abc_newabc?我想从 RStudio 做

我尝试在我的 RStudio 中使用 SSH url 创建一个新项目,所以我abc在笔记本电脑中创建了一个新文件夹,其中包含来自abcgit 服务器的所有文件。现在我该如何abc_new合并abc?如果我从abc_newto复制文件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.
$`

标签: rgitrstudio

解决方案


第 17.5.4 节:happygitwithr.com/existing-github-last.html。您能否使用此方法将您的 github 存储库添加为 abc_new 的远程仓库并推送更改。


推荐阅读