-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer an easy way to fetch/pull the branch matching the name of the current branch #205
Comments
@dscho In simple cases, you could use # once
git config remote.pushDefault my-fork
git config push.default current # unfortunately needed
# then
git fetch my-fork
git rebase @{push} It's on my todo list to make that work without having to change I agree that doing that in one command via |
No:
|
Yeah. I think it could make sense to teach pull to understand |
And what about |
I’m not sure I understand that last bit though.
already works (provided the two config settings I mention above are used) and compares to the current push target... but maybe you meant comparing to branch with the same name on a remote that is not the configured |
My |
Hi @dscho ! I would like to work on this as my microproject for GSOC. As a new contributor, I am not very familiar with the codebase. It would be great if you could provide additional details or point me to any relevant functions/files to start at. |
Hi @victorphoenix3! I am actually not sure that this would make for a fine microproject because it has too much potential to be bogged down in philosophical discussions. For one, not even I am sure how this functionality's user interface should look like. Having said that, the code in question should probably live around the same location where |
When fetching from a remote, one can specify which ref(s) to fetch.
When pulling, there is even a very convenient convention to fetch and merge the "upstream branch", i.e. the one connected via
git branch --set-upstream-to=<remote>/<branch>
.However, there is no convenient way to specify the name of the current branch, other than typing it out. This is a problem e.g. when working on a multi-platform contribution for the Git project itself, where the upstream branch might be
origin/master
, but the contributor needs work on the same branch on multiple machines. In this instance, the branch might need to be updated withgit pull --rebase my-fork <current-branch>
.Let's introduce the
--current-branch
option for this, automagically appending the name of the current branch to the commandsgit fetch
andgit pull
, allowing e.g.git pull --rebase --current-branch my-fork
.The text was updated successfully, but these errors were encountered: