Is there a way to pull files from a branch, including their commit history, into a new branch?
You pull the commit, i.e. the whole repo into the branch, and not just some files.
One good option would be to reset files that you do not want to use for your preliminary content.
--x--x--x (master) \ y--y--y (branch B1 with mixed work) \ z (new branch B2, but with some files reset to master)
B2 starts with B1 and includes the files you want with their history.
But B2 also includes other files from B1 that you would like to be as master .
You can do (in B2 ) a git reset --soft master : a git status will tell you all the changes you need to make so that your index reflects the master. Just do not add changes that are related to the files you want to save.
And do not do it. You just want to change the settings to master for some files.
(See also Practical use of git reset --soft ? ")
Once this is done, a git reset --soft B2 will return HEAD back to B2 (but with an index recording all the changes and deletes necessary to display the wizard for the correct files).
Now you can commit, and the rest of the files will return to master and the files you want intact are identical to B1 , with their history intact.
source share