# Some git mv questions

4 messages from 2007-10-16 to 2007-10-16. Participants: Jan Wielemaker, Lars Hjemli, Linus Torvalds.
Thread: https://gitlist.dev/t/10317

## Jan Wielemaker, 2007-10-16 15:33

Subject: Some git mv questions
Message-ID: <200710161733.49185.wielemak@science.uva.nl>
URL: https://gitlist.dev/e/200710161733.49185.wielemak%40science.uva.nl

```
Hi,

For the impatient, start [HERE].

I'm about to start shuffling files and directories around in a big project,
while others keep working on their files.  This is a bit scary as I
still feel pretty much newbie in the GIT world :-)  

I did a little test as follows.  Given a shared repository sandbox.git
with a file in there I did the following, which worked fine.

	* [player one] clone the DB, edit the file, commit and push
	* [player two] clone the DB
		- git branch shuffle
		- git checkout shuffle
		- mkdir SomeDir
		- git mv file SomeDir
		- edit SomeDir/file
		- git commit -a
	* Sofar so good, now merge:
		- git checkout master
		- git pull (get player 1 changes)
		- git merge shuffle
		- git branch -d shuffle
		- git commit -a
		- git push

Sofar so good, but during the tests I had two times problems:

	* Instead of "git mv file SomeDir" I simply used "mv file SomeDir"
	and git-add.  Now I end up with two files and of course the changes
	are not merged.  I can understand that.

[HERE]
	* On a somewhat bigger test I moved a large directory using
	"git mv dir newdir" (where newdir is an existing directory).
	Now "git status" gives a lot of new and deleted files!?  I
	guess I'm going to have a big mess if that happens in the
	real project.  Moving some smaller test directories simply
	showed a series of renames.

	Can this be explained?  Is this a bug?

	Thanks --- Jan

```

## Lars Hjemli, 2007-10-16 16:05

Subject: Re: Some git mv questions
Message-ID: <8c5c35580710160905v69787856m7ed11b037c1adef1@mail.gmail.com>
URL: https://gitlist.dev/e/8c5c35580710160905v69787856m7ed11b037c1adef1%40mail.gmail.com
In-Reply-To: <200710161733.49185.wielemak@science.uva.nl>

```
On 10/16/07, Jan Wielemaker <wielemak@science.uva.nl> wrote:
>         * On a somewhat bigger test I moved a large directory using
>         "git mv dir newdir" (where newdir is an existing directory).
>         Now "git status" gives a lot of new and deleted files!?

You could try to adjust diff.renameLimit in .git/config

--
larsh

```

## Linus Torvalds, 2007-10-16 17:34

Subject: Re: Some git mv questions
Message-ID: <alpine.LFD.0.999.0710161030430.6887@woody.linux-foundation.org>
URL: https://gitlist.dev/e/alpine.LFD.0.999.0710161030430.6887%40woody.linux-foundation.org
In-Reply-To: <8c5c35580710160905v69787856m7ed11b037c1adef1@mail.gmail.com>

```


On Tue, 16 Oct 2007, Lars Hjemli wrote:

> On 10/16/07, Jan Wielemaker <wielemak@science.uva.nl> wrote:
> >         * On a somewhat bigger test I moved a large directory using
> >         "git mv dir newdir" (where newdir is an existing directory).
> >         Now "git status" gives a lot of new and deleted files!?
> 
> You could try to adjust diff.renameLimit in .git/config

Yes. The default rename limit I did has turned out to be a disaster. It's 
quite common to have more than a 100x100 matrix of deleted files.

For people with any kind of beefy hardware, I'd just suggest doing a

	git config --global diff.renamelimit 0

which disables the rename limiting entirely.

There's a related (embarrassing) problem, namely that I think that the 
current released versions (1.5.3.3 and 1.5.3.4) don't honor the 
renamelimit configuration for merging, so if you do merges across renames 
with changes to the renamed files, you need to use either an older git 
that didn't have the rename limit at all (nor any of the speed-ups) or you 
need to use current git from the 'master' branch.

		Linus

```

## Jan Wielemaker, 2007-10-16 21:09

Subject: Re: Some git mv questions
Message-ID: <200710162309.28739.wielemak@science.uva.nl>
URL: https://gitlist.dev/e/200710162309.28739.wielemak%40science.uva.nl
In-Reply-To: <alpine.LFD.0.999.0710161030430.6887@woody.linux-foundation.org>

```
On Tuesday 16 October 2007 19:34, Linus Torvalds wrote:
> On Tue, 16 Oct 2007, Lars Hjemli wrote:
> > On 10/16/07, Jan Wielemaker <wielemak@science.uva.nl> wrote:
> > >         * On a somewhat bigger test I moved a large directory using
> > >         "git mv dir newdir" (where newdir is an existing directory).
> > >         Now "git status" gives a lot of new and deleted files!?
> >
> > You could try to adjust diff.renameLimit in .git/config
>
> Yes. The default rename limit I did has turned out to be a disaster. It's
> quite common to have more than a 100x100 matrix of deleted files.
>
> For people with any kind of beefy hardware, I'd just suggest doing a
>
> 	git config --global diff.renamelimit 0
>
> which disables the rename limiting entirely.
>
> There's a related (embarrassing) problem, namely that I think that the
> current released versions (1.5.3.3 and 1.5.3.4) don't honor the
> renamelimit configuration for merging, so if you do merges across renames
> with changes to the renamed files, you need to use either an older git
> that didn't have the rename limit at all (nor any of the speed-ups) or you
> need to use current git from the 'master' branch.

Thanks both of you.  I can master that.  I understand I only should ensure
to be running the latest version if I start the merge?

	Cheers --- Jan

```
