1

I found some framework that gives its code using git. So, any their updates can be pulled and merged into my own code.

But the same moment I have my code linked to my own remote repository.

So, the question is -how- and if it's even possible to have the same code linked to one remote repo for pulling their updates and to another one to pushing all updates there? So the workflow could be:

  1. Create my own local repo and pull the code from the remote repo #1.
  2. Do my development in my local repo and push the code to my remote repo #2.
  3. Pull updates if any from the repo #1.
  4. Go to step 2.

How? Possible?

mimic
  • 4,897
  • 7
  • 54
  • 93
  • Do you mean adding a different remote repo to your repo (https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)? – mx0 Oct 05 '18 at 18:14
  • @mx0 to be honest I don't know how it can be fone. Maybe by adding another different remote repo. The point is one remote repo should be used for pulling their updates, another - to pushing our updates. – mimic Oct 05 '18 at 19:12
  • @mx0 Not sure how it can help. The situation is not the same as mine... – mimic Oct 05 '18 at 23:58
  • @mx0 The git documentation you gave tolls only the case when there is one linked remote repo. I have 2, 1 for pulling, another for pushing. – mimic Oct 06 '18 at 00:01

1 Answers1

3

You can add an additional remote repo with git remote add <repo-name> <url> -- just pick a unique name for the remote (not the same as the one you're pulling from!) and its URL.

Then, you can use git push <repo-name> to push your current branch to the same named branch in that remote repo. You can use git branch -u <repo-name> <branch> to set the default upstream of branch to be repo-name -- then you can use simply git push to push to it (but you'll then need to use git pull <orig-repo> to pull more changes from the original repo.)

Chris Dodd
  • 119,907
  • 13
  • 134
  • 226