Let me explain. For some time I developed some code. Now I want to separate a part and make it open-source. My main problem is to save all commit history, which concerns that files.
Asked
Active
Viewed 473 times
-3
-
I doubt you can. Is it necessary to preserve history? Couldn't you make a new git repo, add the files you want, and label it "Initial Commit"? – Madara's Ghost Oct 13 '16 at 09:56
-
That is not interesting – kyb Oct 13 '16 at 09:56
-
1Also https://help.github.com/articles/splitting-a-subfolder-out-into-a-new-repository/ – 1615903 Oct 13 '16 at 10:13
-
Why some "bright mind" found making -1 is good idea? – kyb Oct 13 '16 at 10:17
-
1-1 because the question is poorly worded and is a duplicate as I currently understand it. Please read [how to ask](http://stackoverflow.com/help/how-to-ask). – nonsensickle Oct 13 '16 at 10:39
2 Answers
2
What I suspect you're asking is how to make a subdirectory (or just a set of files) into its own repository. If that is the case then you're asking a question that has been answered many times before:
- Detach (move) subdirectory into separate Git repository
- How to make a part of a Git repository a submodule
- Create a submodule repository from a folder and keep its git commit history
- Rewrite history git filter-branch create / split into submodules / subprojects
and is well documented and googlable:
which goes against the advice on the "How to ask" help page and makes this a candidate for being closed as a duplicate.

Community
- 1
- 1

nonsensickle
- 4,438
- 2
- 34
- 61
0
You can use git blame and save commit history to a file, like:
git blame <full_file_path> > blame_file.txt

M.Sharma
- 224
- 1
- 7