# How to split file with its history?

3 messages from 2019-08-27 to 2019-08-27. Participants: Konstantin, SZEDER Gábor.
Thread: https://gitlist.dev/t/51757

## Konstantin, 2019-08-27 10:10

Subject: How to split file with its history?
Message-ID: <CAObSod2jhDjq=Fw2JtNMsK53HxXSf3n6K5XacHQBH00L49mNpQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAObSod2jhDjq%3DFw2JtNMsK53HxXSf3n6K5XacHQBH00L49mNpQ%40mail.gmail.com

```
currently we have one code file with deep history.
As code file grown it is necessary to split it.
but this action will drop history for the new extracted file.
how can i split one big code file to small files and save its history
for the "blame" action?

-- 
Best regards,
Konstantin K

```

## SZEDER Gábor, 2019-08-27 10:36

Subject: Re: How to split file with its history?
Message-ID: <20190827103653.GB8571@szeder.dev>
URL: https://gitlist.dev/e/20190827103653.GB8571%40szeder.dev
In-Reply-To: <CAObSod2jhDjq=Fw2JtNMsK53HxXSf3n6K5XacHQBH00L49mNpQ@mail.gmail.com>

```
On Tue, Aug 27, 2019 at 01:10:02PM +0300, Konstantin wrote:
> currently we have one code file with deep history.
> As code file grown it is necessary to split it.
> but this action will drop history for the new extracted file.
> how can i split one big code file to small files and save its history
> for the "blame" action?

'git blame -C' can detect lines moved between files.

https://git-scm.com/docs/git-blame#Documentation/git-blame.txt--Cltnumgt


```

## Konstantin, 2019-08-27 10:59

Subject: Re: How to split file with its history?
Message-ID: <CAObSod1tMmLVNciNL_C4i_Xb7VQPwWc0uJtzLc0tntZF3KH2zg@mail.gmail.com>
URL: https://gitlist.dev/e/CAObSod1tMmLVNciNL_C4i_Xb7VQPwWc0uJtzLc0tntZF3KH2zg%40mail.gmail.com
In-Reply-To: <20190827103653.GB8571@szeder.dev>

```
thank you. your answer is pretty complete.

On Tue, Aug 27, 2019 at 1:36 PM SZEDER Gábor <szeder.dev@gmail.com> wrote:
>
> On Tue, Aug 27, 2019 at 01:10:02PM +0300, Konstantin wrote:
> > currently we have one code file with deep history.
> > As code file grown it is necessary to split it.
> > but this action will drop history for the new extracted file.
> > how can i split one big code file to small files and save its history
> > for the "blame" action?
>
> 'git blame -C' can detect lines moved between files.
>
> https://git-scm.com/docs/git-blame#Documentation/git-blame.txt--Cltnumgt
>


-- 
Best regards, Konstantin Kosukhin

```
