Jira Courses, Training and Consulting: Sparxsys Trainings
Thanks for coming here, I hope you are enjoying learning here, I have also written some books in case you want to learn a bit more :)
If you need my help with Drupal, Linux, Jira, Scripting, Automation or want to contact me then raise a ticket for me please :) and I will get back to you, promise. At Sparxsys we provide Atlassian consultancy services, reach out to me at ravi at sparxsys dot com

Duplicating a git repository to another repository - Bitbucket

Duplicating a git repository to another repository - Bitbucket
I always used SVN for managing my projects, that was the case till last year. Though Drupal.org moved to GIT too few years back, I did not completely move to GIT. The main reason was the comfort level. Of course GIT offer plenty of good features but SVN was also not bad, and most importantly I was the only developer on those projects.

Since last year our team has grown and we now use Bitbucket only for managing our code on git repositories. At Sparxsys we offer Drupal development at really competitive prices and our main USP is to deliver fast. Some of the projects have common functionality so we re-use the code of other projects. This may not be true for big complex projects but if we get a requirement for a relatively simple site with standard dynamic features for managing the content, forums, blogs, news, slideshows then we prefer to re-use the code.

For the past 1 year I was mostly involved in managing clients, sales, branding and non-technical activities but since last few weeks I have decided to get involved more deeply in the projects. So my role is now more of developer where I actually build websites, write modules and do lot of designing using Omega4 theme in SASS.

Here I am sharing very simple instructions to duplicate/mirror a git repository.

First create a bare clone of the old GIT repository on your local

  1. git clone --bare https://username@bitbucket.org/username/OLD-PROJECT.git

# Make a bare clone of the repository

You may want to do this in the folder other than your DocumentRoot that contains the folders of your other projects. Just to avoid confusion.

Now move into the directory

  1. cd OLD-PROJECT.git

Push the code into the new repository

Of course you should create this empty repository before running this command.

  1. git push --mirror https://username@bitbucket.org/username/NEW-PROJECT.git

# Mirror-push to the new repository

Finally you may want to delete the old directory

  1. cd ..
  2. rm -rf OLD-PROJECT.git

# Remove our temporary local repository

And it is done. Easy no?

Similar posts

Subscribe

* indicates required

Please confirm that you would like to from Sparxsys:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices.

Want to contact me?