So let's say there are three developers: Alice, Bob, and Cecil. They decide to use Git without a central repo. They all set up remotes to each other, so that:
remotes/bob/master
remotes/cecil/master
remotes/alice/master
remotes/cecil/master
remotes/alice/master
remotes/bob/master
And now, Alice wants her local master branch to track both remote master branches. Is that even possible in Git? If not, what workflow do you guys use to work around this?
To view your remote branches, simply pass the -r flag to the git branch command. You can inspect remote branches with the usual git checkout and git log commands. If you approve the changes a remote branch contains, you can merge it into a local branch with a normal git merge .
When you're publishing a local branch. You can tell Git to track the newly created remote branch simply by using the -u flag with "git push".
There is a command that gives you about all tracking branches. And to know about the pull and push configuration per branch you can use the command git remote show origin. and you can use -sb option for seeing the upstream. Hope this information will help you to find which branch is tracking.
Tracking a remote branch means you want to automatically merge changes from the remote branch you're tracking into your local branch. The default behavior of git push pushes changes into a configured upstream only when the names of the local and remote are the same.
How to track more than one remote with a given branch using Git?
In short, "can't be done unless you write a custom script/program/alias".
I suggest that they either agree on a common central branch that holds the development tree, or that they send each other pull requests instead of asking each developer to track every other developer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With