-1

First of all, I'm a super noob when it comes to git. I have connected my RStudio to my GitHub repo without using any git code.

The problem is my commits are being pushed to a local branch (called master) instead of my remote: origin (also called master). I think this started happening when I deleted a file out of my repo. I must have chosen to make the commits go to a branch instead of the main master without realizing it.

RStudio informs me that my branch is ahead of the 'origin/master' by 2 commits: Branch is ahead of the origin/master

And when I try to select the remote master (my GitHub repo), RStudio tells me that it's already on 'master'.

Selecting REMOTE: ORIGIN

Already on 'master'

And when I type "git merge --no-ff master" into the shell, it says it's already up to date... possibly because my remote origin and local branch are both called master?

I've tried "git push" and receive the following error: Updates were rejected because the remote contains work that you do not have locally...

I hope this makes sense, but I'd be happy to clarify anything. I'm really new at this! Thank you!

  • https://stackoverflow.com/search?q=%5Bgit%5D+Updates+were+rejected+because+the+remote+contains+work+that+you+do+not+have+locally – phd Oct 15 '19 at 17:43

1 Answers1

0

Try pulling the repo from origin first; make the changes and then use

git push origin master