>> >> >> Reference << << << <<<<<<Ref>>>>>>
push
Modified: 2025-12-31 | Author:ljf12825

git push的作用是把本地提交推送到远程仓库,让别人能看到改动

git push <远程名> <分支名>

例如

git push origin main

意为

注意事项

git pull --rebase # 先拉取并在新基础上重放你的提交
# 或者
git merge origin/main

push的原理是把本地提交的对象(commit、tree、blob)上传到远程,更新远程分支指针

常见参数

git push origin main
git push --force origin main
git push --force-with-lease origin main
git push --set-upstream origin feature-branch
git push --all origin
git push --tag
git push --dry-run