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

Re: [PATCH 2/2] git-init: set receive.guardCurrentBranch = true for non-bare repositories

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 24, 2008, 11:00 UTC
Message-ID
<alpine.LSU.1.00.0803241158301.4353@racer.site>
In-Reply-To
<7v4pax3r6l.fsf@gitster.siamese.dyndns.org>
Hi,
On Sun, 23 Mar 2008, Junio C Hamano wrote:
Show 11 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > When initializing a non-bare repositories, you most likely want to 
> > avoid pushing into the current branch (because a push does not touch 
> > the working tree at all).
> 
> As I described in my other message, I suspect that treating the current 
> branch specially like this is a wrong approach.  The configuration might 
> be a good idea, but shouldn't it prevent any local branch from getting 
> updated?  Push into non-bare repository is simply a fetch run in reverse 
> direction.
That would break this work flow:
	# machine A
	$ git push B master:refs/heads/tmp
	# machine B
	$ git merge tmp
	$ git branch -d tmp

Besides, there is a _vital_ difference between the current branch, and any other local branch: pushing into other local branches cannot make your working tree stale.

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 11 in “Introduce receive.guardCurrentBranch”
  1. 1/2 Introduce receive.guardCurrentBranchJohannes Schindelin, Mar 23, 2008
  2. 2/2 git-init: set receive.guardCurrentBranch = true for non-bare repositoriesJohannes Schindelin, Mar 23, 2008
  3. Junio C HamanoMar 24, 2008
  4. Johannes SchindelinMar 24, 2008
  5. Junio C HamanoMar 24, 2008
  6. Johannes SchindelinMar 24, 2008
  7. Daniel BarkalowMar 24, 2008
  8. Johannes SchindelinMar 24, 2008
  9. Miklos VajnaMar 24, 2008
  10. Johannes SchindelinMar 24, 2008
  11. Miklos VajnaMar 24, 2008

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.