0

I've searched for this, but could find an information regarding this.

I would like to clone a repository and keep the commit history, however I only want to have the flatten history, not all the tree bubbles:

History

How can I remove them, that I have a clean repository (without all subtrees):

• Fixed overloading
|
• Fixed EUR 1000
|
• Fixed comments
|
• Temporary disabled

Thanks!

Tim
  • 2,805
  • 25
  • 21
  • 6
    You can't. A clone is that, a clone of the repository, you can't pick and choose the bits your want and those you don't – Liam May 21 '19 at 10:43
  • Are you going to sync (pull and push) commits/branches between the original repository and your clone? If yes you cannot change commit graph — it must be synchronized on both ends. But if you're going to forget about the origin and work only with your cloned repo — you cannot clone streamlined graph but you can streamline it after cloning. – phd May 21 '19 at 10:58
  • @phd I'm going to forget about the origin and work in the new repository, so the old one doesn't need to be in sync ;-) – Tim May 21 '19 at 11:02
  • 1
    Then you can rebase all branches one by one onto master and then rebase master itself to remove merge commits. Something like this: https://stackoverflow.com/a/39315063/7976758 – phd May 21 '19 at 11:03

1 Answers1

0

A clone of a repository will show the branches and the commit history. I am not sure if this is the ideal way but in order to "flatten" it, you can just merge all of it together and merge it to one branch and delete the rest. If you do need to access the previous commits or branches, you can access them via the git reflog command.

alextechtai
  • 101
  • 2