Skip to content

Instantly share code, notes, and snippets.

View oleksii-khalikov's full-sized avatar

Oleksii Khalikov oleksii-khalikov

View GitHub Profile
@oleksii-khalikov
oleksii-khalikov / dump-spb.md
Created April 19, 2025 07:01 — forked from grentank/dump-spb.md
Полезные ссылки с доклада DUMP SPB 2025
@oleksii-khalikov
oleksii-khalikov / combining-git-repositories.md
Created June 3, 2023 22:34 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@oleksii-khalikov
oleksii-khalikov / deploy.php
Created February 24, 2016 10:29 — forked from krisnoble/deploy.php
A slightly modified version of Brandon Summers' script. For more information: http://simianstudios.com/blog/post/using-bitbucket-for-automated-deployment-of-multiple-repositories
<?php
date_default_timezone_set('Europe/London'); // Set this to your local timezone - http://www.php.net/manual/en/timezones.php
/**
* The root directory where the repos live.
*
* @var string
*/
$root_dir = '/your/root/dir/';