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

Re: how to revert changes in working tree?

From
LYLiu Yubao <yubao.liu@gmail.com>
Date
Dec 6, 2006, 11:14 UTC
Message-ID
<4576A60A.3060003@gmail.com>
In-Reply-To
<81b0412b0612060220n11fb7e19hc6ed202759962bd3@mail.gmail.com>
Alex Riesen wrote:
Show 16 quoted lines
> On 12/6/06, Liu Yubao <yubao.liu@gmail.com> wrote:
>> Alex Riesen wrote:
>> > On 12/6/06, Liu Yubao <yubao.liu@gmail.com> wrote:
>> >> I'm confused how to revert changes in working tree:
>> >>
>> >> $ git fetch
>> >> $ git merge "sync with origin" HEAD origin
>> >> ....conflict....
>> >
>> > You may want to consider git pull. It'd do exactly the same
>>
>> It's said somewhere "git pull" has strange behaviour and fetch+pull
>> is recommended.
> 
> So why do you use fetch+merge?
> 
Oh, another mistake, I have heard fetch+merge is recommended.
Show 5 quoted lines
> so, you just have an unresolved merge.
> It was discussed on this mailing list very recently
> (and actually is being discussed), so just look at
> the archives.
> 
Thanks, I will dig it.
Show 24 quoted lines
>> > They problem is the exec-bit which windows does not
>> > have and cygwin failed to correctly workaround the
>> > limitation.
>> >
>> > Do a "git repo-config core.filemode false" to almost
>> > disable the checks for exec bit.
>> >
>>
>> It has been set. I guess the cause is a interrupted merge
>> operation that leads to textual difference.
> 
> yes, though what I can't understand is why don't you have
> unmerged entries... Maybe it comes from playing with
> all these commands you mentioned in the original mail.
> 
>> After run "git reset --hard", all deleted files come back, but I reach
>> the old state:
>> $ git status
> 
> When? Immediately after git reset --hard? Then you very
> likely have no permission to write (or lost it somehow) into
> the working directory, otherwise I don't see could this be
> possible. git reset --hard rewrites everything.
> 

Yes, immediately after git reset --hard. I'm sure I have write permission because all deleted files come back and no "permission denied" like message appears.

I will try to run git in debugger, wish I can get the reason.
Show 14 quoted lines
>> HEAD: commit 088406bcf66d6c7fd8a5c04c00aa410ae9077403
>> master: commit 088406bcf66d6c7fd8a5c04c00aa410ae9077403
>> origin: commit ff51a98799931256b555446b2f5675db08de6229
>> "git diff --cached" shows nothing;
> 
> which is correct.
> 
>> "git diff" shows many diffs:
> 
> and this is not. You do have changes, which could not be reset.
> I fail to see why. Are you sure you haven't accidentally repeated
> the merge after doing git reset --hard? And what was _exactly_
> git merge told you, when it failed?
> 

I didn't run "git merge" after "git reset --hard" indeed. To get the message from "git merge", now I run it like this:

$ git merge "sync from origin" HEAD origin Updating 088406b..ff51a98 include/linux/netfilter/xt_CONNMARK.h: needs update include/linux/netfilter/xt_DSCP.h: needs update include/linux/netfilter/xt_MARK.h: needs update include/linux/netfilter_ipv4/ipt_CONNMARK.h: needs update include/linux/netfilter_ipv4/ipt_DSCP.h: needs update include/linux/netfilter_ipv4/ipt_ECN.h: needs update include/linux/netfilter_ipv4/ipt_MARK.h: needs update include/linux/netfilter_ipv4/ipt_TCPMSS.h: needs update include/linux/netfilter_ipv4/ipt_TOS.h: needs update include/linux/netfilter_ipv4/ipt_TTL.h: needs update include/linux/netfilter_ipv6/ip6t_HL.h: needs update include/linux/netfilter_ipv6/ip6t_MARK.h: needs update net/ipv4/netfilter/ipt_ECN.c: needs update net/ipv4/netfilter/ipt_TOS.c: needs update net/ipv4/netfilter/ipt_TTL.c: needs update net/ipv6/netfilter/ip6t_HL.c: needs update net/netfilter/xt_CONNMARK.c: needs update net/netfilter/xt_DSCP.c: needs update net/netfilter/xt_MARK.c: needs update fatal: Entry 'net/ipv4/netfilter/ipt_ECN.c' not uptodate. Cannot merge.

Previous: Alex RiesenNext: Alex Riesen
Message 5 of 11 in “how to revert changes in working tree?”
  1. Liu YubaoDec 6, 2006
  2. Alex RiesenDec 6, 2006
  3. Liu YubaoDec 6, 2006
  4. Alex RiesenDec 6, 2006
  5. Liu YubaoDec 6, 2006
  6. Alex RiesenDec 6, 2006
  7. Jakub NarebskiDec 6, 2006
  8. Shawn PearceDec 6, 2006
  9. Liu YubaoDec 7, 2006
  10. Juergen RuehleDec 7, 2006
  11. Jakub NarebskiDec 6, 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.