我用于提交的默认 git 存储库是什么?

发布于 2024-11-16 11:32:15 字数 972 浏览 3 评论 0原文

如果我输入 git remote -v 我会得到一些 git 存储库:

origin  [email protected]:me/MyProject.git (fetch)
origin  [email protected]:me/MyProject.git (push)
testheroku  [email protected]:test.git (fetch)
testheroku  [email protected]:test.git (push)
upstream    git://github.com:me/MyProject.git (fetch)
upstream    git://github.com:me/MyProject.git (push)

我刚刚在 README 文件上运行了“git commit”,并希望这会更新 MyProject.git 上的文件 - 这似乎不是案件。我错了吗?

另外,有人可以澄清什么是上游吗?这是否意味着我领先于一个分支或者到底是什么?

谢谢, 齿轮。

If I type git remote -v I get a number of git repos:

origin  [email protected]:me/MyProject.git (fetch)
origin  [email protected]:me/MyProject.git (push)
testheroku  [email protected]:test.git (fetch)
testheroku  [email protected]:test.git (push)
upstream    git://github.com:me/MyProject.git (fetch)
upstream    git://github.com:me/MyProject.git (push)

I've just done ran "git commit" on the README file and would have expected this to update the file on MyProject.git - this does not appear to be the case. Am I wrong?

Also, can somebody clarify what upstream is? Does it mean I'm ahead of a branch or what exactly?

Thanks,
Gearoid.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

忆梦 2024-11-23 11:32:15

提交是本地的。你需要推动他们。

git push origin mybranch # this is probably master in your case

如果您一直这样做,则可以设置默认值以决定将更改推送到哪些遥控器。然后,您就可以

git push

根据您的配置,从任何分支进行的更改将上升到任何远程。第一次推送时,您可以

git push -u origin mybranch

设置该分支,以自动包含该分支以推送到该存储库。后续

git push

将相当于

git push origin mybranch

要更熟悉,请查看

git remote show
git remote show origin
git config -l

此外,您可能不需要最后一个遥控器。你可以摆脱它

git remote rm upstream

希望这会有所帮助

Commits are local. You need to push them.

git push origin mybranch # this is probably master in your case

If you do this all the time, you can set up defaults as to which remotes the changes will be pushed. Then you can just

git push

and your changes from any branches will go up to any remotes depending on your configuration. The first time you push, you can

git push -u origin mybranch

and this will set up that branch to automatically be included for pushing to that repository. A subsequent

git push

will be equivelant to

git push origin mybranch

To get more familiar, take a look at

git remote show
git remote show origin
git config -l

Also, you probably don't need the last remote. You can get rid of it with

git remote rm upstream

Hope this helps

演多会厌 2024-11-23 11:32:15

当您提交时,您将提交到本地存储库。每个 git 工作目录都有一个关联的存储库。

origin、testheroku 和上游都是您可以轻松推送和拉取的遥控器(您也可以显式使用未列出的存储库)。

如果您这样做:

git push

它可能会(取决于配置)自动推送到 originmaster 分支。

此外,第一个和第三个似乎是相同的存储库,只是具有不同的 URL。

您还可以根据需要在本地创建分支,但这是另一个主题。

When you commit, you're committing to your local repository. Every git working directory has an associated repo.

origin, testheroku, and upstream are all remotes you can easily push and pull from (you can also explicitly use a repo not listed).

If you do:

git push

it will probably (depending on configuration) push to origin's master branch automatically.

Also, the first and third appear to to be the same repos, just with different URLs.

You can also create branches as needed locally, but that's a different topic.

煮酒 2024-11-23 11:32:15
git remote -v show
git branch -vv
git config branch.$branch.remote

git remote -v show 显示有关您的遥控器的有趣信息

gitbranch -vv 命令将向您显示特定分支的上游,可能默认情况下推送到的位置。

然而,当你说 git push 时, git configbranch.master.remote 是唯一确定你推送到哪里的绝对方法。

git remote -v show
git branch -vv
git config branch.$branch.remote

git remote -v show shows interesting information about your remotes

The git branch -vv command will show you your upstream for a specific branch which is probably where you push to by default.

However git config branch.master.remote would be the only absolute method to know for sure where you push to when you say git push

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文