version control - How do I split a file in Git? -


i have source file a, getting long , contains 2 large classes. want split files a , b, preserving history , "blame" data.

in subversion, easy: svn copy b, delete lines a should in b , vice versa, commit. project's owner sadly wants switch git, , 1 of workflows don't know how do.

when svn log b, b's history after split, plus a's history before split. additionally, svn blame b attribute pre-split changes correct authors in history of a, rather attribute them whomever did split.

git not explicitly track renames. instead needed calculates if rename has occurred. example, commands git blame, git diff , git merge can make use of git's rename detection machinery.

for reason should make change need , commit normal.

so correct steps case be:

<make needed changes files> git add b git commit 

given renaming not explicitly tracked means rename detection algorithm needs little bit of tuning achieve need. example, when doing merge might need adjust rename-threshold=<n> better auto-merge.

if similarity of "renamed" files below git detects, or can configured detect, there no way git consider rename.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -