D
D
Daniel2542019-02-01 23:31:33
git
Daniel254, 2019-02-01 23:31:33

Git how to work with two repositories and a shallow clone?

There is an open source project on github.
I cloned one branch "10.0" from it with a depth of one commit. I don’t need more, and it takes up a lot of space if I clone it completely.
Created a branch "dev" on the working machine to make changes.
Now I need to send this branch to another private repository, which will be the main one.
And at the same time, from time to time, pull commits from the original project on github ("10.0") and merge them into your working branch "dev".
Can you please tell me how to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Bedoyar, 2019-02-06
@PulpiRZVK

Your main repository goes under the name origin. You add the second one, for example, under the name main and push all the code there

git remote add main <repo_url>
git push main dev:dev

now the update process will look something like this
git checkout master
git pull origin master
git checkout dev
git merge master
git push main dev:dev

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question