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

Re: git push requires a subsequent git reset --hard ?

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Jul 2, 2008, 13:36 UTC
Message-ID
<20080702133606.GP5737@dpotapov.dyndns.org>
In-Reply-To
<m3vdzpfr16.fsf@localhost.localdomain>
On Tue, Jul 01, 2008 at 10:29:38AM -0700, Jakub Narebski wrote:
> 
> This is considered normal.  Push would never touch index nor working
> area (although if you are the only user, and you know what you are
> doing, you can add "git reset --hard HEAD" to post-receive hook).

Doing "reset --hard" makes all your uncommit changes to be lost. OTOH, if you push on the local branch assotiated with HEAD then recovering all uncommit changes later will not be easy either. So, I wonder, if git push should require --force if you want to push to the HEAD branch of a non-bare repo. It will be at least some warning (especially for novices) to not to do that, and those who really want to understand what they are doing can use --force.

Dmitry
Previous: Jakub NarebskiNext: Neshama Parhoti
Message 4 of 6 in “git push requires a subsequent git reset --hard ?”
  1. Neshama ParhotiJul 1, 2008
  2. Jeff KingJul 1, 2008
  3. Jakub NarebskiJul 1, 2008
  4. Dmitry PotapovJul 2, 2008
  5. Neshama ParhotiJul 4, 2008
  6. Dmitry PotapovJul 2, 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.