Di Shi Zhi Hui
23030816 需求:备份一个 repo 到另一个 github 账号的 repo,首先需要同步所有分支,然后更改 remote url,最后推送所有分支到新仓库。 How do I fetch all Git branches? How do I change the URI (URL) for a remote Git repository? Set up git to pull and push all branches git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done git fetch --all git pull --all # change the URLs git remote set-url origin new.git.url/here # push tags and branches. git push --all origin 20230812 Web 调试 ...