-
-
Save alekpopovic/531df49fbd3a4ca55c44ed947f415028 to your computer and use it in GitHub Desktop.
Revisions
-
xtream1101 revised this gist
Jun 29, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Here we will restore the repo from the bundle and create a new remote origin tha ``` 3. Create a new repo on your git server and update the origin of the local repo ``` git remote set-url origin [email protected]/xtream1101/test-backup.git ``` 4. Push all branches and tags to the new remote origin ``` -
xtream1101 created this gist
Jun 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ # Backup/archive a repo 1. Clone the repo ``` git clone --mirror https://github.com/vuejs/vue ``` 2. `cd` into the cloned repo 3. Create a bundle file in the parent directory ``` git bundle create ../vuejs_vue.bundle --all ``` 4. That bundle file is now a full archive of the repo, including all of its branches and tags # Restore a repo from a bundle file Here we will restore the repo from the bundle and create a new remote origin that will contain all brnaches and tags 1. Clone the repo from the bundle ``` git clone vuejs_vue.bundle ``` 2. Get all the branches locally to be pushed up to your origin later (from: https://gist.github.com/grimzy/a1d3aae40412634df29cf86bb74a6f72) ``` git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done git fetch --all git pull --all ``` 3. Create a new repo on your git server and update the origin of the local repo ``` git remote set-url origin [email protected]:xtream1101/test-backup.git ``` 4. Push all branches and tags to the new remote origin ``` git push --all git push --tags ```