| 默认行为 | 当前分支 → 上游分支(simple 模式) |
|---|---|
| refspec | git push <远端> <本地>:<远端分支> |
| 演练 | --dry-run 只报告不推送 |
常用示例
常用示例
git push
git push origin main
git push origin HEAD:feature-x
git push --dry-run
git push origin --tags新分支推送一次后建议建立跟踪(-u),之后无参数 push 语义清晰、不易推错。
把本地提交送到远端:默认推当前分支到其上游(push.default=simple);支持 refspec 映射与 --dry-run 演练。
| 默认行为 | 当前分支 → 上游分支(simple 模式) |
|---|---|
| refspec | git push <远端> <本地>:<远端分支> |
| 演练 | --dry-run 只报告不推送 |
git push
git push origin main
git push origin HEAD:feature-x
git push --dry-run
git push origin --tags