0

Having problem with saving commits history. I have main branch called 'master'. In the root folder I have a directory named 'kp' and some other stuff, which I don't need anymore. I want to get everything in 'kp' folder out and put it to the root directory and save commits history of the files in a folder. I'v tried to (step by step):

  1. Clone the repo;
  2. Create new branch;
  3. Use a command git filter-branch to get my data from 'kp' folder;
  4. Push a new branch to a repo.

But there is no history. What I'm doing wrong?

tshepang
  • 12,111
  • 21
  • 91
  • 136
alexvassel
  • 10,600
  • 2
  • 29
  • 31
  • Why not just "delete everything else"? – KingCrunch Apr 14 '11 at 13:41
  • As far as I understand: You want to delete everything except the content of the folder `kp/` and you want to move the content of the folder `kp/` into the root of your repository. So my first suggestion is exactly that. Just delete everything, except the one folder, move everything down and commit. – KingCrunch Apr 14 '11 at 13:49
  • Yes, you understood right. And the history will be saved? What about creating of another branch? I can't do any experiments in the main branch. – alexvassel Apr 14 '11 at 13:53

1 Answers1

0

I believe the answer you're looking for is here.

Community
  • 1
  • 1
splicer
  • 5,344
  • 4
  • 42
  • 47
  • I'll try it. But have a question. I did exactly like KingCrunch said (above) and the history has been saved. So why I should use git filter-branch way? Or maybe i misunderstood something? – alexvassel Apr 14 '11 at 14:15
  • The reason people suggest filter branch for what you're doing is most times someone asks this question they want it to look like that content was never even in the repository, which you can do with filter branch. With the suggestion of KingCrunch all of that content is still in the repo, if you checkout the previous commit it will all be there. This is fine if you're not worried about repo size (the usual impetuous for filter branch.) – asm Apr 14 '11 at 17:21