0

I m a bit confused about the local and git account online. Posts like this has commands like git fetch upstream. But how do I use it in the git fork in the browser?

  • I have forked a project project1 into my account (in my git URL). call it projectforked.
  • Then I created an R Project in my local RStudio using projectforked as my origin. call it projectforked_R_local
  • Made changes to few files from projectforked_R_local.
  • In the meantime, project1 got added with changes

So I am trying to -

  • get project1 changes into projectforked.
  • Then sync projectforked_R_local to projectforked.
  • and then create a pull request to project1 owner to merge the changes in projectforked to project1.
sjd
  • 1,329
  • 4
  • 28
  • 48

1 Answers1

0

You could actually do this two ways.

  • If this is a true online fork, like project1 is on GitHub and you said Fork and got projectForked, there is a button right there on GitHub that lets you bring projectForked up to date. So then in projectforked_R_local you just pull or whatever.

  • Otherwise, you have to use projectforked_R_local as the intermediary. You give it another remote, usually termed upstream, which points at project1. This is in addition to projectForked which is probably termed origin. Then you fetch from upstream, rebase/merge as desired to a local branch, and push to origin.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Thanks. I followed the second option to to create branch based on `project1` using `git remote add upstream url` and `git fetch upstream` . Commited my changes in `projectforked_R_local` and then did `git rebase upstream`. But there were conflicts not resolved. So I created a copy somewhere else. did `git rebase --skip` and modified the files with the changes.. `git commit`, `git push`. Worked perfect.. – sjd Jun 20 '20 at 05:10