I’m a newbie (like 6 months) Linux user.
I’m using Git for quite a while, and now I’d like to start learning more advanced stuff. What I’d like to learn is a variety of ways to handle/manage remotes.
So my question is — how can I setup a “remote” locally? Is it possible to create two folders, for example:
/home/my_user/git_experiment/remote_branch
/home/my_user/git_experiment/local_branch
and set local_branch folder to track remote_branch folder just like if remote_branch would be a repo on GitHub?
A remote is just a clone which you have some way to access. Commonly it’s accessed via the git protocol or http (for reading) and ssh or https (for writing), but filesystem access works just as well. All you need to do is clone your repo:
The origin remote will automatically be set up in project2, pointing to project, just like you’re used to. You could add a corresponding remote in project, pointing to project2, and try out whatever fetching and pulling you want to do.
If you want to try out pushing, make sure you make a bare clone to push into:
I’m not sure why you’re naming them “local_brach” and “remote_brach” (is that meant to say “branch”?). These aren’t branches. They’re clones; they can have their own full sets of branches, probably with some corresponding.