Are you able to copy a repo in bitbucket without history

Beau Rogers December 17, 2018

I have a project in repository 1 with commits A-B-C-D-E. I want to create a new repository (repository 2) with the same project but to simplify all the commits that were done, I would like to have repository 2 have commits B-E. Ie, I would like to create repository 2 starting from repository 1B. I would then update it in a single commit such that repository 2 would look like repository 1E (but would be done with a single commit). How can I copy repository 1B into a new repository (repository  2)?

 

Thanks in advance

2 answers

1 accepted

0 votes
Answer accepted
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 18, 2018

Hi Beau,

That sounds like a complicated operation that I wouldn't recommend unless you're experienced with git. On a very high level, it would involve cloning the repo, revert changes to B, then copy-pasting this code file (not cloning as that would involve all the history) into a new directory and initializing a repo, then replacing the code file you just pasted by the completed code file (the file with all the changes from A-B-C-D-E) and commit this. 

And most importantly, don't forget to take a backup of your original file in case things don't go as you expect.

Good luck!

Ana

0 votes
Beau Rogers December 18, 2018

Thank you, that seemed to work. One problem that I did run into when I was doing this however was the invisible .git file that kept record of the old commits. Just and FYI for anybody else who runs into this issue

Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 18, 2018

That's definitely something to keep in mind, as most people will copy-paste the whole directory instead of each file individually ;) 

Glad I could help you! Have a nice day,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events