user1466978
user1466978

Reputation: 81

git cloning two times and pushing through two levels

I am a newbie in git. I don't know if this is possible. what I am doing is I cloned a remote repository in my desktop. I then again cloned that cloned repo into another folder. Is there anyway to connect all these repo. Will i be able to make change to the second clone and push it through first clone and finally to remote repository?

Upvotes: 4

Views: 244

Answers (1)

VonC
VonC

Reputation: 1327184

You can change the origin of the second clone in order to push directly to the remote repo:

cd /path/to/second/clone
git remote set-url origin /url/of/remote/repo

Or you can add a new remote (still in the second clone) in order to reference the original remote repo

cd /path/to/second/clone
git remote add upstream /url/of/remote/repo

In that latter case, pushing will by default push to the first clone.
But a git push upstream aBranch would push directly to the remote repo.

Upvotes: 3

Related Questions