用于初始化和上传存储库的 Mercurial 操作的 git 等效项是什么?
在 Mercurial 中,我通常这样做:
hg init
hg addremove
hg commit -m "init repo"
hg push https://arezzo:[email protected]/arezzo/mynewrepo
我在 git 中尝试了类似的操作,但没有成功:
git init .
git add .
git commit -m "init repo"
git push https://arezzo:[email protected]/arezzo/mynewrepo
push
后得到的消息是:
Everything up-to-date
没有任何内容被推送到 bitbucket。
In Mercurial, I usually do this:
hg init
hg addremove
hg commit -m "init repo"
hg push https://arezzo:[email protected]/arezzo/mynewrepo
I tried something similar in git and it didn't work:
git init .
git add .
git commit -m "init repo"
git push https://arezzo:[email protected]/arezzo/mynewrepo
The message I get after push
is:
Everything up-to-date
Nothing gets pushed to bitbucket.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您在使用 git push 时未指定要推送的分支时,默认情况下只会推送远程存储库中存在同名分支的分支。在这种情况下,我猜这是您第一次推送到此存储库,因此还没有名为
master
的分支 - 因此,git Push URL
不会不要推动任何东西。另一个可能有用的提示是,当您使用 git 时,您通常会创建一个
remote
作为存储库 URL 的短名称。因此,要稍微修改您的步骤,请尝试以下操作:然后您可以使用
origin
代替 URL。您只需在第一次推送时使用-u
选项 - 它只是设置一些有用的默认配置选项,以便git pull
无需其他参数即可工作,例如。When you don't specify a branch to push when you're using
git push
, it by default will only push branches where a branch with the same name exists in the remote repository. In this case, I guess that this is the first time that you're pushing to this repository, so there is no branch calledmaster
yet - thus,git push URL
doesn't push anything.Another tip that may be useful is that you usually create a
remote
as a short name for the repository URL when you're using git. So, to modify your steps slightly, try the following instead:Then you can use
origin
in place of the URL. You only need to use the-u
option the first time that you push - it just sets up some helpful default config options so thatgit pull
works without additional arguments, for instance.