Federico Mena Quintero <federico@xxxxxxxxxx> writes: > I ran into a problem where "git pull" was refusing to do anything, and > it turns out that I hadn't set up my branch to track the remote branch I > was interested in. Thanks to people on the IRC channel who pointed that > out to me :) You did not have to. You can instead spell out which branch you are interested in for that particular invocation of pull. > Here's a a couple of patches to clarify the documentation and to add a > more helpful error message to git-pull. Please don't. I briefly looked at the patch text and they look Ok-ish, but one message per patch is the standard procedure around here. For a set of good example patches, see recent "strbuf" series from Pierre Habouzit. It is almost perfect except for the two-space indent on the first line of each paragraph he adds. > diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt > index 33bc31b..c5a484d 100644 > --- a/Documentation/git-branch.txt > +++ b/Documentation/git-branch.txt > @@ -91,6 +93,15 @@ OPTIONS > --no-abbrev:: > Display the full sha1s in output listing rather than abbreviating them. > > +--track:: > + Make a branch track another one, so that gitlink:git-pull[1] > + will automatically merge changes from the other branch. For > + example, to create a new branch and track a remote branch, you > + could do "git branch --track mybranch origin/remotebranch" > + > +--no-track: > + Make a branch not track another branch anymore. > + Thanks for noticing the omission of these in the OPTIONS list. The body text of the DESCRIPTION part has the correct version, so does the OPTIONS list in git-checkout (the crucial difference is that branching off of another local branch does not make much sense making it tracked). You may also want to mention branch.autosetupmerge configuration here to illustrate why the --no-track option is useful. > diff --git a/git-pull.sh b/git-pull.sh > index 5e96d1f..3253226 100755 > --- a/git-pull.sh > +++ b/git-pull.sh > @@ -98,7 +98,22 @@ case "$merge_head" in > curr_branch=${curr_branch#refs/heads/} > > echo >&2 "Warning: No merge candidate found because value of config option > - \"branch.${curr_branch}.merge\" does not match any remote branch fetched." > + \"branch.${curr_branch}.merge\" does not match any remote branch fetched. > + This branch is not set up to track any other branches. You can set > + it up now with > + > + git branch --track <source-branch> > + > + or you can do it for new branches with > + > + git checkout --track -b <new-branch> <source-branch> > + > + If you want this to be the default behavior when creating branches, > + you can do > + > + git config branch.autosetupmerge true > + > + to avoid having to pass the --track option every time." I am not so sure it "tracking" should be considered the norm. While I would agree up to "This branch is not set up to track any other branches." part, I would probably insert "please name which branch you want to merge on the command line. If you want to almost always want to merge with the same branch, then" before suggesting to set up tracking. > Subject: [PATCH] Fix whitespace > > Signed-off-by: Federico Mena Quintero <federico@xxxxxxx> > --- > Documentation/git-checkout.txt | 2 +- > git-pull.sh | 12 ++++++------ > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt > index a0b0458..ec78dc8 100644 > --- a/Documentation/git-checkout.txt > +++ b/Documentation/git-checkout.txt > @@ -47,7 +47,7 @@ OPTIONS > by gitlink:git-check-ref-format[1]. Some of these checks > may restrict the characters allowed in a branch name. See > also the '--track' and '--notrack' options to set up whether > - the new branch should track an existing branch for use with > + the new branch should track an existing branch for use with > gitlink:git-pull[1]. Please do not do this; you are fixing up your own mess in a patch that has not been applied. Instead, fix the original patch so that it does not introduce trailing whitespaces in the first place. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html