git 中别名和分支的区别
我是版本控制和 git 的新手。我对 git push [alias] [branch] 感到困惑。
别名和分支有什么区别?
I'm new to version control and git. I'm confused by git push [alias] [branch]
.
What is the difference between an alias and branch?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(3)
[alias]
是您的主远程存储库的别名。[branch]
是您的项目分支名称。例如,我在 github 上有一个存储库(比方说,yourRepo),其主要远程存储库是
[电子邮件受保护]:user/yourRepo.git
。您经常会将
其添加到本地存储库中。然后,您可以通过以下方式将更新推送到 github:
这里
origin
通常用作主远程存储库
的别名。git 还有一些其他类型的别名。例如,您可以将
com
设为commit
的别名。这里的别名不是您问题中的[alias]
。我刚才顺便提了一下。也许你会喜欢它。 ;)[alias]
is your Primary remote repository's alias. And[branch]
is your branch name of the project.For example, I have a repo(let's say, yourRepo) on github, and its primary remote repository is
[email protected]:user/yourRepo.git
.You'll often do
to add it to your local repo. Then you can push your update to github by
Here
origin
is often used as alias forprimary remote repository
.There're still some other type of alias for git. For example, you can do
to make
com
alias tocommit
. The alias here is not the[alias]
in your question. I just mentioned it by the way. Maybe you'll like it. ;)通过
别名
我认为你的意思是存储库
?因此,您运行的典型命令可能是 git Push origin master 。其中
origin
是您要推送到的存储库的名称,master
是要推送的分支名称。By
alias
I think you meanrepository
?So a typical command you'd run might be
git push origin master
. Whereorigin
is the name of the repository you are pushing to andmaster
is the branch name to push.您可以为分支创建自己的别名。如果您愿意,可以为
master
分支创建一个名为sweet-mother-of-god
的别名。You can create your own aliases for branches. If you feel for it, you can make an alias for the
master
branch calledsweet-mother-of-god
.