sjd
sjd

Reputation: 1401

Git project in Rstudio - restore changes from backup

I have a repository named abc in git hub. I have a modified version(newer version) of the same repository in my Linux laptop as a backup folder- abc_new.

How do I get abc_new to link with abc in the server and commit the changes in abc_new to abc? I want to do it from RStudio

I tried to create a new project using the SSH url in my RStudio so i got a new folder abc created in laptop with all files from abc git server. Now how do I merge abc_new with abc? If I copy files from abc_new to abc and commit, it gets created as duplicate files in github server.

There are no forks and only 1 branch to my local for the project.

Tried the steps given in the link https://happygitwithr.com/existing-github-last.html and got merge errors.

The last 2 steps `git remote add origin` and `git push` failed for me with  below errors `$ git remote add origin [email protected]:path.git
fatal: remote origin already exists.
$ git push --set-upstream origin master
To [email protected]:path.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]: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.
$`

Upvotes: 0

Views: 79

Answers (1)

JCran
JCran

Reputation: 375

Section 17.5.4: happygitwithr.com/existing-github-last.html. Could you add your github repo as a remote from abc_new using this method and push the changes.

Upvotes: 1

Related Questions