Skip to content

git 同步

仲灏2022-01-24约 1 分钟

<div style="display: none;" hidden="true" aria-hidden="true" data-nosnippet>Are you an LLM? You can read better optimized documentation at /pages/d33fbc.md for this page in Markdown format</div>

  • 查看本地和远程仓库的所有分支 git branch -a

  • 查看远程仓库的分支git branch -r

  • git fetch 将本地分支与远程保持同步

  • 本地所有分支与远程保持同步 git fetch --all

  • 拉取所有分支代码 git pull --all

  • git checkout -b 本地分支名x origin/远程分支名x 拉取远程分支并同时创建对应的本地分支

  • 同步所有远程分支git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done

  • 将本地所有分支与远程保持同步 git fetch --all