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

Re: How to force a pull to succeed?

From
JWJeffrey Walton <noloader@gmail.com>
Date
May 16, 2017, 03:47 UTC
Message-ID
<CAH8yC8kVFGe9gnj8P+=Pp1ToDvMPXiViVM-HzhkZ6SAteoPZaQ@mail.gmail.com>
In-Reply-To
<xmqqmvad31sr.fsf@gitster.mtv.corp.google.com>
On Mon, May 15, 2017 at 11:42 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 37 quoted lines
> Jeffrey Walton <noloader@gmail.com> writes:
>
>> On Mon, May 15, 2017 at 11:27 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Jeffrey Walton <noloader@gmail.com> writes:
>>>
>>>> I scp'd a file to another machine for testing. The change tested OK,
>>>> so I checked it in on the original machine.
>>>> ...
>>>> How do I force the pull to succeed?
>>>
>>> Git doesn't know (or care) if you "scp"ed a file from a known to be
>>> good place, or if you modified it in the editor.  When it notices
>>> that there are differences you may rather not to lose in these files
>>> (because they are different from HEAD), it refrains from touching
>>> them.
>>>
>>> So the way to go forward is for you to make sure that you do not
>>> have such local changes in the repository that your "pull" is trying
>>> to touch.  An easiest way would be to do
>>>
>>>         git checkout HEAD -- <paths>..
>>
>> Thanks. That's an extra command. Is there any way to roll it up into
>> one command?
>
>         git checkout HEAD -- <paths>.. && git pull
>
> ;-)
>
>>> before doing a "git pull" to clear the damage you caused manually
>>> with your "scp".
>>
>> There's no damage. Its expected.
>
> The fact that you think it is expected is immaterial. Git doesn't
> know (or care) how you made the files different from HEAD, so it
> looks like a damage to it.

'git pull' fails and its expected, but 'git pull -f' is supposed to succeed. That's what -f is supposed to do.

Is there a way to add intelligence to Git so that it sees they are the _exact_ same file, and it stops bothering me with details of problems that don't exist?

It seems like adding the intelligence is a good enhancement. A version control tool has to do three things: check-out, check-in, and determine differences. Its not doing a good job of determining differences considering they are the exact same file.

Jeff
Previous: Junio C HamanoNext: Jeff King
Message 5 of 6 in “How to force a pull to succeed?”
  1. Jeffrey WaltonMay 16, 2017
  2. Junio C HamanoMay 16, 2017
  3. Jeffrey WaltonMay 16, 2017
  4. Junio C HamanoMay 16, 2017
  5. Jeffrey WaltonMay 16, 2017
  6. Jeff KingMay 16, 2017

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.