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

Re: Is there a "git reset --keep <sha1> || git reset --hard <sha1>" alternative?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 20, 2016, 20:28 UTC
Message-ID
<CACBZZX7ELH+5fzkRiZBNyWDwpQgzpEGi15XGz21nQQFh5hiG1g@mail.gmail.com>
In-Reply-To
<xmqqvb3cumpd.fsf@gitster.mtv.corp.google.com>
On Wed, Apr 20, 2016 at 9:03 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>>     $ ls -l INSTALL ; chmod 600 INSTALL ; git reset --hard @{u} ; ls -l INSTALL
>>     -rw-r--r-- 1 avar avar 9147 Apr 20 17:11 INSTALL
>>     HEAD is now at e6ac6e1 Fifth batch for post 2.8 cycle
>>     -rw-r--r-- 1 avar avar 9147 Apr 20 17:12 INSTALL
>
> A quick question.  What happens when you did this instead?
>
>         chmod 600 INSTALL
>         git update-index --refresh
>         git reset --hard
>
> Does it match what you want to see?
>
> The reason I ask is because I recall making a deliberate design
> decision around this area.
The --hard doesn't wipe away the chmod, makes sense:
    $ ls -l INSTALL ; chmod 600 INSTALL ; git update-index --refresh;
git reset --hard @{u} ; ls -l INSTALL
    -rw-r--r-- 1 avar avar 9147 Apr 20 22:27 INSTALL
    HEAD is now at 05045e0 tracing
    -rw------- 1 avar avar 9147 Apr 20 22:27 INSTALL
Previous: Junio C Hamano
Message 3 of 3 in “Is there a "git reset --keep <sha1> || git reset --hard <sha1>" alternative?”
  1. Ævar Arnfjörð BjarmasonApr 20, 2016
  2. Junio C HamanoApr 20, 2016
  3. Ævar Arnfjörð BjarmasonApr 20, 2016

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.