- Open Git Bash.
- Create a bare clone of the repository.
$ git clone --bare https://github.com/USERNAME/OLD-REPOSITORY.git
- Mirror-push to the new repository.
$ cd old-repository.git $ git push --mirror https://github.com/USERNAME/NEW-REPOSITORY.git
- Remove the temporary local repository you created earlier.
$ cd .. $ rm -rf old-repository.git
- Open Git Bash.
- Create a bare mirrored clone of the repository.
$ git clone --mirror https://github.com/USERNAME/REPOSITORY-TO-MIRROR.git
- Set the push location to your mirror.
$ cd repository-to-mirror.git $ git remote set-url --push origin https://github.com/USERNAME/mirrored
Create blank repository, then:
git clone https://github.com/tes-id/tes-merge.git
cd tes-merge
git remote add -f old_a https://github.com/tes-id/old_a.git
git merge old_a/master --allow-unrelated-histories
git remote add -f old_b https://github.com/tes-id/old_b.git
git merge old_b/master --allow-unrelated-histories
# if the automatic merge failed; fix conflicts and then commit the result.
git add *
git commit -m "merge files from repo old_a and old_b"
git push
Create blank repository, then:
git clone https://github.com/tes-id/tes-merge.git
cd tes-merge
git remote add -f old_a https://github.com/tes-id/old_a.git
git merge old_a/master --allow-unrelated-histories
mkdir old_a
dir –exclude old_a | %{git mv $_.Name old_a}
git commit -m "Move old_a files into subdir"
git remote add -f old_b https://github.com/tes-id/old_b.git
git merge old_b/master --allow-unrelated-histories
mkdir old_b
dir –exclude old_a,old_b | %{git mv $_.Name old_b}
git commit -m "Move old_b files into subdir"