Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upWhen does push() set the upstream tracking branch? #375
Comments
|
I actually checked this behaviour myself in the past couple of days and, when we're talking about a push to Github, |
@jennybc Thanks for the confirmation! I'm struggling to figure out if it ever worked for me. I tried installing git2r 0.21.0, but observed this same behavior. I switch back and forth between git2r and Git so often, I'm thinking I may have just missed this the whole time. |
That's a very good question. I have studied the code and I can't find that the |
|
Yes, I think it would be great to expose this in a similar fashion as |
@stewid Yes, it would be useful to have that option. Though since it does appear to sometimes add the upstream tracking branch, the documentation should probably explain that |
The documentation for
push()states that it adds an upstream tracking branch (source):And the unit tests confirm this behavior. Below I've copied line line 64 through line of 68 of
tests/push.Rfollowed by a test I added:However, for these unit tests, the remote repository is a local Git repository on the same machine. When I try to replicate this behavior when the remote repository is on GitHub, the upstream tracking branch is not set.
I checked the usethis package, and they also manually set the upstream tracking branch after running
git2r::push(source):What is the expected behavior of
git2r::push()in regards to setting the upstream tracking branch? Is it supposed to when the remote repository is hosted on GitHub or another online provider? If not, could the documentation be updated to describes the rules for when it does or doesn't set the upstream tracking branch?Potentially related: #133