问题
I'm planning to wholesale refactor my entire project.
It may mean some file renaming, but mostly it will involve a lot of re-organizing of files.
New directories being created, files moving from one directory to another, or from one to a new directory etc.
Will git and my repo maintain it's history under these changes?
回答1:
If you want to refactor in GIT and move files but still keep track of their history you need to use git mv
.
Due to the way that git manages the content (It save in different places the content and the metadata of the file names) you must do it using git mv
Once you do git mv
and move files to their new location git will mark the files as renamed which means that its still keeping its history but the file was renamed - not the content simply the file name/path
来源:https://stackoverflow.com/questions/31257932/git-i-want-to-refactor-my-codebase-and-create-new-files-structures-and-move-th