Hongmu Notes

git push

推送提交到远程仓库

100% Browser local processing 0 Data upload

Common examples

将当前分支的本地更改推送到其默认的远程对应分支

git push

将指定本地分支的更改推送到其远程对应分支

git push {{远程仓库名}} {{本地分支名}}

将指定本地分支的更改推送到其远程对应分支,并将该远程分支设为该本地分支 push/pull 的默认目标分支

git push {{[-u|--set-upstream]}} {{远程仓库名}} {{本地分支名}}

将指定本地分支的更改推送到指定的远程分支

git push {{远程仓库名}} {{本地分支名}}:{{远程分支名}}

将所有本地分支的更改推送到指定远程仓库中各个对应分支

git push --all {{远程仓库名}}

删除远程仓库中的分支

git push {{远程仓库名}} {{[-d|--delete]}} {{远程分支名}}

删除没有本地对应分支的远程分支

git push --prune {{远程仓库名}}

推送本地的新标签到远程仓库

git push --tags

Tip: curly braces{{…}}It is the parameter that needs to be replaced (path, file name, etc.); the command is only executed in the local terminal, and this site does not save any input.

English original text comparison

Expand English instructions and examples (source tldr-pages)

Push commits to a remote repository. More information

Send local changes in the current branch to its default remote counterpart

git push

Send changes from a specific local branch to its remote counterpart

git push {{remote_name}} {{local_branch}}

Send changes from a specific local branch to its remote counterpart, and set the remote one as the default push/pull target of the local one

git push {{[-u|--set-upstream]}} {{remote_name}} {{local_branch}}

Send changes from a specific local branch to a specific remote branch

git push {{remote_name}} {{local_branch}}:{{remote_branch}}

Send changes on all local branches to their counterparts in a given remote repository

git push --all {{remote_name}}

Delete a branch in a remote repository

git push {{remote_name}} {{[-d|--delete]}} {{remote_branch}}

Remove remote branches that don't have a local counterpart

git push --prune {{remote_name}}

Publish tags that aren't yet in the remote repository

git push --tags

command information

command namegit push
Purpose推送提交到远程仓库
Applicable platforms通用
Number of examples8 Article
Official documentationhttps://git-scm.com/docs/git-push
Data sourcetldr-pages(CC-BY-4.0)· Community Chinese Translation

FAQ

git push What does the command do?

推送提交到远程仓库

git push How to use it?

Pages listed by scene8Commonly used examples: Each example first explains the purpose, and then gives a complete command that can be directly copied (the parameters that need to be replaced are in the curly brackets).

git push What are the most commonly used operations?

将当前分支的本地更改推送到其默认的远程对应分支:git push

What do the curly braces in the command mean?

curly braces{{…}}Indicates that you need to replace it with your own value, such as path and file name; square brackets for parameters with the same name (such as[-C|--directory]) indicates optional writing.