把目前repo 所有的branch都push 到github

你想要把目前本地 repo 的 所有 branch 都推送到 GitHub。這在 Windows/Linux 都一樣可以做到,只要用 Git 的 push 指令。

方法一:一次推送所有 branch

git push --all origin
  • --all 代表把所有本地分支都推送。
  • origin 是你遠端的 GitHub repo 名稱(通常 clone 下來預設就是 origin)。

方法二:逐一推送

如果你只想推送特定分支,可以:

git push origin branch_name

方法三:包含 tag 一起推送

如果你也想把 tag 一併推送:

git push --all origin
git push --tags origin

⚠️ 注意事項

  • 你的 repo 有些 branch 可能 checkout 不了(像 aux.c 那些檔案在 Windows 無法建立),這會導致 push 失敗或 branch 無法正確同步。
  • 建議在 Linux 或 WSL 環境下操作,才能完整 checkout 並推送所有 branch。
  • 如果只是要備份到 GitHub,而不需要在 Windows 上編譯,可以直接在 Linux/WSL 上 clone 再 push。

Also See

File14FileLast Modified
把目前 branch 上的修改(尚未 commit 的檔案)直接帶到一個新的 branch把目前 branch 上的修改(尚未 commit 的檔案)直接帶到一個新的 branch2:24 PM - January 12, 2026
從 Windows 把 repo 搬到 WSL再一次性 push 所有 branch 到GitHub 這樣就能避開 aux 檔名問題從 Windows 把 repo 搬到 WSL再一次性 push 所有 branch 到GitHub 這樣就能避開 aux 檔名問題2:24 PM - January 12, 2026
git指定初始化的 branch 名稱git指定初始化的 branch 名稱2:24 PM - January 12, 2026
github上的repo clone下來check out 某一個dev branchgithub上的repo clone下來check out 某一個dev branch2:24 PM - January 12, 2026
github一台電腦同時使用兩個 GitHub 帳號github一台電腦同時使用兩個 GitHub 帳號2:24 PM - January 12, 2026
github actionsgithub actions2:24 PM - January 12, 2026
git 重新再從github上pull 所有branchgit 重新再從github上pull 所有branch2:24 PM - January 12, 2026
Git 裡查看 configurationGit 裡查看 configuration2:24 PM - January 12, 2026
git 恢復到最近一次 git pull狀態,取消本地修改git 恢復到最近一次 git pull狀態,取消本地修改2:24 PM - January 12, 2026
git 初始化與推送流程圖git 初始化與推送流程圖2:24 PM - January 12, 2026
git 中查看commit歷史資訊git 中查看commit歷史資訊2:24 PM - January 12, 2026
git 中修改檔名且保留原來commit紀錄git 中修改檔名且保留原來commit紀錄2:24 PM - January 12, 2026
git Remote 常見情境與操作git Remote 常見情境與操作2:24 PM - January 12, 2026
git GUI tool, SourceTreegit GUI tool, SourceTree2:24 PM - January 12, 2026