Skip to content

Latest commit

 

History

History
81 lines (66 loc) · 2.4 KB

git.md

File metadata and controls

81 lines (66 loc) · 2.4 KB

Git

Duplicating a Repository

Mirroring a repository

  1. Open Git Bash.
  2. Create a bare clone of the repository.
    $ git clone --bare https://github.com/USERNAME/OLD-REPOSITORY.git
    
  3. Mirror-push to the new repository.
    $ cd old-repository.git
    $ git push --mirror https://github.com/USERNAME/NEW-REPOSITORY.git
    
  4. Remove the temporary local repository you created earlier.
    $ cd ..
    $ rm -rf old-repository.git
    

Mirroring a repository in another location

  1. Open Git Bash.
  2. Create a bare mirrored clone of the repository.
    $ git clone --mirror https://github.com/USERNAME/REPOSITORY-TO-MIRROR.git
    
  3. Set the push location to your mirror.
    $ cd repository-to-mirror.git
    $ git remote set-url --push origin https://github.com/USERNAME/mirrored
    

Reading Material


Merging Repository

Project Related

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

Project Not Related

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"

Reading Material