# GIT pull

5 messages from 2012-04-12 to 2012-04-12. Participants: cvalusek, Matthieu Moy, Michael Witten, Johannes Sixt.
Thread: https://gitlist.dev/t/30224

## cvalusek, 2012-04-12 14:47

Subject: GIT pull
Message-ID: <1334242077960-7459655.post@n2.nabble.com>
URL: https://gitlist.dev/e/1334242077960-7459655.post%40n2.nabble.com

```
My apologies if this isn't the appropriate place to post this. We are using
the windows port msysgit so I understand if I need to post over there first.

I have also posted this on stackoverflow. Here is a link to the question
there:

http://stackoverflow.com/questions/10110401/why-doesnt-git-clean-up-when-aborting-a-merge-triggered-from-pulling-in-changes

My team has had a lot of trouble with GIT lately because of aborted pull
commands.

If a user has local modifications not on the index and does a pull, I have
seen git attempt to start applying the merge to master and abort. The whole
checkout is then left in a terrible state that is nearly unrecoverable. In
the past, I thought GIT would run some sort of check to identify these
problems before it attempts the merge.

Even with a clean state (nothing to commit), I have seen the same thing
randomly happen at least once. I understand that without rebasing, you may
be forced to resolve merge conflicts when you pull, but this is not what is
happening though.

We are using gitolite. I am mainly using command line and have yet to run
into these issues. The rest of the team is using the git-gui or in 1 case
TortoiseGit.

git-gui version 0.13.GITGUI
git version 1.7.8.msysgit.0
Tcl/Tk version 8.5.1
TortoiseGit 1.7.6.0

We are not working with branches as much as we could, but feel like this
should be working.
Why does GIT allow you to try to pull when it is going to train-wreck?
Why does GIT not abort cleanly?

--
View this message in context: http://git.661346.n2.nabble.com/GIT-pull-tp7459655p7459655.html
Sent from the git mailing list archive at Nabble.com.

```

## Matthieu Moy, 2012-04-12 15:03

Subject: Re: GIT pull
Message-ID: <vpqiph5m1pd.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqiph5m1pd.fsf%40bauges.imag.fr
In-Reply-To: <1334242077960-7459655.post@n2.nabble.com>

```
cvalusek <clintv2@gmail.com> writes:

> If a user has local modifications not on the index and does a pull, I have
> seen git attempt to start applying the merge to master and abort. The whole
> checkout is then left in a terrible state that is nearly
> unrecoverable.

What do you mean by "terrible state"? What does "git status" say?

> In the past, I thought GIT would run some sort of check to identify
> these problems before it attempts the merge.

Git does check uncommited changes before merging. It allows the merge if
the changes touch different files (i.e. if the merge is guaranteed not
to touch the same files as the one for which you have uncommited
changes).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Michael Witten, 2012-04-12 15:07

Subject: Re: GIT pull
Message-ID: <CAMOZ1Bs+vvoNJ5jiKEkc-VBBR0Bj_ik9bu6TfKd-0r70Ss0mPg@mail.gmail.com>
URL: https://gitlist.dev/e/CAMOZ1Bs%2BvvoNJ5jiKEkc-VBBR0Bj_ik9bu6TfKd-0r70Ss0mPg%40mail.gmail.com
In-Reply-To: <vpqiph5m1pd.fsf@bauges.imag.fr>

```
On Thu, Apr 12, 2012 at 15:03, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> cvalusek <clintv2@gmail.com> writes:
>
>> If a user has local modifications not on the index and does a pull, I have
>> seen git attempt to start applying the merge to master and abort. The whole
>> checkout is then left in a terrible state that is nearly
>> unrecoverable.
>
> What do you mean by "terrible state"? What does "git status" say?
>
>> In the past, I thought GIT would run some sort of check to identify
>> these problems before it attempts the merge.
>
> Git does check uncommited changes before merging. It allows the merge if
> the changes touch different files (i.e. if the merge is guaranteed not
> to touch the same files as the one for which you have uncommited
> changes).

Also, if there *are* conflicts, then you should get an error that
looks like the following:

  error: Your local changes to the following files would be
  overwritten by merge:
  	some-file.txt
  Please, commit your changes or stash them before you can merge.
  Aborting

Sincerely,
Michael Witten

```

## Johannes Sixt, 2012-04-12 16:58

Subject: Re: GIT pull
Message-ID: <4F8709CA.6080102@kdbg.org>
URL: https://gitlist.dev/e/4F8709CA.6080102%40kdbg.org
In-Reply-To: <1334242077960-7459655.post@n2.nabble.com>

```
Am 12.04.2012 16:47, schrieb cvalusek:
> My team has had a lot of trouble with GIT lately because of aborted pull
> commands.
> 
> If a user has local modifications not on the index and does a pull, I have
> seen git attempt to start applying the merge to master and abort. The whole
> checkout is then left in a terrible state that is nearly unrecoverable. In
> the past, I thought GIT would run some sort of check to identify these
> problems before it attempts the merge.
> 
> Even with a clean state (nothing to commit), I have seen the same thing
> randomly happen at least once.

As others pointed out, this should not happen. That leaves one
possibility: You are on Windows, and you very likely have one or more of

- a virus scanner
- an IDE

running. It can happen that one of these programs happen to look at a
file at the same moment when git is trying to remove or rename the file.
This fails because on Windows a file that is open cannot be removed or
renamed. In this situation, the merge/checkout is aborted in the middle
and leaves a mess behind.

There's not a lot that can be done about it. I thought we have some
counter measures in our compatibility layer (e.g., retry the removal if
the first attempt fails due to permissions), but I have seen this happen
nevertheless. I haven't tried tracking it down because it happens so
rarely for me, and it didn't hurt *too* much so far.

-- Hannes

```

## cvalusek, 2012-04-12 17:29

Subject: Re: GIT pull
Message-ID: <1334251743350-7460163.post@n2.nabble.com>
URL: https://gitlist.dev/e/1334251743350-7460163.post%40n2.nabble.com
In-Reply-To: <1334242077960-7459655.post@n2.nabble.com>

```
Looks like it's the virus scan. I had this e-mail that I accidentally sent to
Michael directly instead of the list:

I will see if I can build a script that reproduces the issue we are seeing. 

We are starting to speculate about what is going on now. Maybe our virus
scan is causing some git operation to fail in the middle of the merge.

The "terrible state" is a half-way applied merge.

--
View this message in context: http://git.661346.n2.nabble.com/GIT-pull-tp7459655p7460163.html
Sent from the git mailing list archive at Nabble.com.

```
