Reputation: 2038
As titled.
For the column Local branches configured for 'git pull':
. I know we should set every branch an upstream branch to make the git pull
and git push
work for them.
But for Local refs configured for 'git push':
shown as below, what does it mean here? And how can I change the items inside it? (did not find a place inside .git
where I can change the items of this column)
Upvotes: 2
Views: 712
Reputation: 489123
... I know we should set every branch an upstream branch to make the
git pull
andgit push
work for them.
This is not strictly necessary, but is a good idea, yes. (Without an upstream setting, you must type more stuff in to get each command to work, and you can make mistakes here, so setting the upstream means it's easier to get your work done, and less likely that you'll get it wrong.)
But for
Local refs configured for 'git push':
shown as below, what does it mean here?
A ref (or reference, if you like to spell it out) is a branch name, tag name, or other similar name. Branch names are refs whose full spelling starts with refs/heads/
, so if you have a branch named ff
, its full name is refs/heads/ff
. For some reason, instead of saying "Local branches configured for 'git push'", Git says "Local refs configured for 'git push'".
And how can I change the items inside it?
You generally should pay little or no attention to this output. It's rooted in an earlier era in Git, many years ago. However, there are some cases where its output can be relevant:
git push
would do. (I don't know of anyone who actually uses a push mirror. They seem a bit specialized.)push.default
to matching
—which is the way Git behaved those many years ago—it will accurately list what git push
would do.remote.remote.push
, it will tell you something about this configuration setting.Note that in all cases, for the output to be correct, the set of branches that exist on that other Git must remain the same, and their associated hash IDs must be unchanged, between the time git remote show
tells you what would happen, and the time you actually do run git push
.
If you haven't configured any special push settings, and are using a modern Git with push.default
defaulting to simple
, a git push
will only actually push the current branch by default, making the output from git remote show
irrelevant. In all cases, a git push
where you list any refspecs will use the refspecs you supply, so the output from the git remote show
command remains irrelevant. But if you have matching
as your push.default
setting, and/or run git push
without specifying any refspecs on the command line, your Git will use the configured remote.remote.push
as the default refspecs, or use the matching mechanism or the mirror setting; in these cases, if the set of branch names on the remote has not changed, the listing from git remote show
will tell you which names your Git will ask their Git to set.
(Note that a few Linux distributions still come with a truly ancient Git in which the push.default
setting defaults to matching
. If your Git version is 2.0 or higher, though, your Git will default to simple
.)
Upvotes: 2