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

Re: Rationale for the "Never commit to the right side of a Pull line" rule

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 26, 2006, 17:11 UTC
Message-ID
<Pine.LNX.4.64.0610261003590.3962@g5.osdl.org>
In-Reply-To
<ehqp1u$j4$1@sea.gmane.org>
On Thu, 26 Oct 2006, Jerome Lovy wrote:
> 
> Could someone please point me to / give me the rationale for the "Never commit
> to the right side of a Pull line" rule ?
It's not a technical rule per se.

It's just a way to avoid what will almost inevitably otherwise be a horribly horribly confusing situation.

I say "almost inevitably", because if you really have worked with git enough, and understand how it works on a very fundamental level, there are actually no problems at all with doing so, and maybe you could have perfectly fine reasons to break the rule, and commit to a branch that is officially "maintained in another repository" and then push it out.

But it's a good rule in general, just because it makes a certain common workflow explicit. In fact, we really probably should start to always use the "refs/remote/origin/HEAD" kind of syntax by default, where you can't even _switch_ to the branch maintained in the remote repository, because it's not a real branch locally.

So normally you should consider the "origin" branch to be a pointer to WHAT YOU FETCHED LAST - and that implies that you shouldn't commit to it, because then it loses that meaning (now it's "what you fetched last and then committed your own work on top of", which is something totally different).

Previous: Jerome LovyNext: Karl Hasselström
Message 2 of 5 in “Rationale for the "Never commit to the right side of a Pull line" rule”
  1. Jerome LovyOct 26, 2006
  2. Linus TorvaldsOct 26, 2006
  3. Karl HasselströmOct 26, 2006
  4. Jakub NarebskiOct 26, 2006
  5. Luben TuikovOct 27, 2006

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.