git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Useful tracking branches and auto merging

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 5, 2010, 20:10 UTC
Message-ID
<7vvd5g5rjq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTinXJ5E_U=5uP_zvWLQBssQsYC74JyVv1N3-eMXK@mail.gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 6 quoted lines
> I believe this use-case is valid:
>
> * The user wants *all* his remote tracking branches to point to the
> latest branch head in all the repos in the case the can be
> fast-forwarded, and in the case they can't, print an error and
> continue with the rest.
I would not be so sure about the validity of that use case.

If your tracking branches are always trailing, never having any real work of your own, there is no reason to have them locally, instead of checking them out on demand. So let's forget about that case.

When you are collaborating with somebody else, sharing a topic branch, and you are behind because you were not working on it while the other parties progressed the shared topic, it would be convenient if your local branch is fast-forwarded before you start to work on it. One possible solution for that would be to teach "git pull" to fast-forward such backgrounded tracking branches that are not checked out. Another obvious alternative is to teach "git checkout" tell you where you are, and even tell you that you could fast-forward [*1*].

On the other hand, if you have forked a topic branch to build your new nifty feature at some known point (e.g. immediately after the upstream reached a new stable point), but you haven't done any real work on it, it is doubtful that it is even a good idea to fast-forward it automatically to begin with. C.f.

   Message-ID: <AANLkTim85sH_2o=xCiDuoQrHq_7ZL96Y91xQMGxUP5Fy@mail.gmail.com>
   "The real problem is that maintainers often pick random - and not at
    all stable - points for their development to begin with. They just
    pick some random "this is where Linus -git tree is today", and do
    their development on top of that. THAT is the problem - they are
    unaware that there's some nasty bug in that version."

IOW, once I decided one point is a good place to fork a topic, created a branch off of it, but didn't have a chance to do a real work on it yet, it would be very irritating if "git pull" updated that branch only because I do not have my own commit on it yet.

I see little sanity in doing this with any option whose name has "all"; it largely depends on the workflow, and in a single repository, some branches may want to get fast-forwarded automatically while others don't [*2*].

[Footnotes]

*1* It is plausible that you could go one step further and define branch.frotz.autofastforward configuration variable to tell "git checkout" to fast-forward in such a case, perhaps only when the working tree and the index are clean.

*2* It also is plausible that the same branch.frotz.autofastforward configuration variable can be noticed by "git pull".

Previous: Felipe ContrerasNext: Felipe Contreras
Message 12 of 13 in “Useful tracking branches and auto merging”
  1. Felipe ContrerasOct 4, 2010
  2. Jonathan NiederOct 4, 2010
  3. Felipe ContrerasOct 4, 2010
  4. Jonathan NiederOct 4, 2010
  5. Felipe ContrerasOct 4, 2010
  6. Clemens BuchacherOct 10, 2010
  7. Felipe ContrerasOct 10, 2010
  8. Clemens BuchacherOct 10, 2010
  9. Felipe ContrerasOct 10, 2010
  10. Junio C HamanoOct 5, 2010
  11. Felipe ContrerasOct 5, 2010
  12. Junio C HamanoOct 5, 2010
  13. Felipe ContrerasOct 7, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.