update: git backup and restore documentation improved.
This commit is contained in:
parent
bc16701f53
commit
f24a7033d1
1 changed files with 20 additions and 10 deletions
|
|
@ -91,20 +91,28 @@ Add executable flag on Windows:
|
||||||
git update-index --chmod=+x git_mirror.sh
|
git update-index --chmod=+x git_mirror.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
Check the remote branch of a cloned repository and change it:
|
Backup a repository from a source with all branches and tags.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# fresh clone
|
||||||
|
git clone --mirror <source-repo-url>
|
||||||
|
|
||||||
|
# existing local clone update
|
||||||
|
git fetch --all --tags --prune
|
||||||
|
|
||||||
|
#Optional: zip it
|
||||||
|
tar czf repo-backup.git.tar.gz repo.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Restore a repository to a new destination with all branches and tags.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd repo.git
|
||||||
|
git remote -v
|
||||||
|
git remote set-url origin <new-repo-url>
|
||||||
git remote -v
|
git remote -v
|
||||||
|
|
||||||
git remote set-url origin xwr@vs-ssh.visualstudio.com:v3/xwr/jambor.pro/app-docker-compose
|
git push --mirror
|
||||||
|
|
||||||
git remote -v
|
|
||||||
|
|
||||||
for branch in $(git branch -r | grep -v '\->'); do
|
|
||||||
git checkout ${branch#origin/}
|
|
||||||
git push -u origin HEAD
|
|
||||||
git push --tags origin
|
|
||||||
done
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Renaming branches:
|
Renaming branches:
|
||||||
|
|
@ -122,3 +130,5 @@ git branch -m main wikiMaster
|
||||||
# Push
|
# Push
|
||||||
git push origin HEAD
|
git push origin HEAD
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue