Mercurial新手困惑

发布于 2024-10-16 16:13:52 字数 413 浏览 1 评论 0原文

我熟悉 TFS 和 Vault,但刚开始使用 Mercurial 时我似乎陷入了一些混乱。

这是我(认为)我所做的:

-在 bitbucket.org 上创建了一个中央存储库

-在我的台式电脑上,从 bitbucket 克隆存储库,添加文件,提交它们,将它们推送到 bitbucket

-在我的笔记本电脑上,从 bitbucket 克隆存储库,拉出文件,添加更多文件,提交它们,将它们推送到bitbucket

我继续在不同的计算机上添加,编辑等。

现在我注意到每台计算机上的某些文件不在 bitbucket 存储库中,因此仅在本地存储库中。似乎没有多少拉动和推入可以将其放入 bitbucket 存储库中。

我最有可能做错的事情是什么? 有没有办法通过更改 bitbucket 存储库来“强制”?

I am familiar with TFS and Vault, but having just started using Mercurial I seem to be getting into a bit of a mess.

Heres what I (think) I've done:

-Created a central repository on bitbucket.org

-On my desktop PC, cloned repository from bitbucket, added files, commit them, push them to bitbucket

-On my laptop, cloned repository from bitbucket, pulled files, added more files, commit them, push them to bitbucket

I've continued to add, edit etc on the different computers.

Now I've noticed that some files from each computer are not in the bitbucket repository, and therefore only in the local repository. No amount of pulling and pushing seems to get it into the bitbucket repository.

What is the most likely thing I've done wrong?
Is there a way to 'force' by changes up to the bitbucket repository?

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

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

发布评论

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

评论(1

玉环 2024-10-23 16:13:52

他们进入你的本地存储库了吗?我怀疑不是,即它们是未添加到提交中的新文件。在提交之前使用 hg add 将它们添加到变更集中,或者使用您正在使用的 Mercurial 界面的任何等效项。

编辑:

这是来自 Mercurial 的帮助:

C:\Users\Bert>hg add --help
hg add [OPTION]... [FILE]...

add the specified files on the next commit

    Schedule files to be version controlled and added to the repository.

    The files will be added to the repository at the next commit. To undo an
    add before that, see "hg forget".

    If no names are given, add all files to the repository.
...

请参阅Mercurial:权威指南(又名 hg“红皮书”)了解更多信息:

http://hgbook.red-bean.com/read/mercurial-日常使用.html

告诉 Mercurial 要跟踪哪些文件

Mercurial 无法处理存储库中的文件,除非您告诉它管理它们。 hg status 命令会告诉您 Mercurial 不知道哪些文件;它使用“?”显示此类文件。

要告诉 Mercurial 跟踪文件,请使用 hg add 命令。添加文件后,该文件的 hg status 输出中的条目将从“?”更改为“?”到“A”。

$ hg init add-example
$ cd add-example
$ echo a > myfile.txt
$ hg status
? myfile.txt
$ hg add myfile.txt
$ hg status
A myfile.txt
$ hg commit -m 'Added one file'
$ hg status

use "hg -v help add" to show global options

Did they get into your local repository? I suspect not, i.e. they were new files that were not added to the commit. Use hg add to add them to the changeset before committing or whatever the equivalent is for whatever mercurial interface you're using.

Edit:

Here's the help from Mercurial:

C:\Users\Bert>hg add --help
hg add [OPTION]... [FILE]...

add the specified files on the next commit

    Schedule files to be version controlled and added to the repository.

    The files will be added to the repository at the next commit. To undo an
    add before that, see "hg forget".

    If no names are given, add all files to the repository.
...

See Mercurial: The Definitive Guide (a.k.a. the hg "red book") for more info:

http://hgbook.red-bean.com/read/mercurial-in-daily-use.html

Telling Mercurial which files to track

Mercurial does not work with files in your repository unless you tell it to manage them. The hg status command will tell you which files Mercurial doesn't know about; it uses a “?” to display such files.

To tell Mercurial to track a file, use the hg add command. Once you have added a file, the entry in the output of hg status for that file changes from “?” to “A”.

$ hg init add-example
$ cd add-example
$ echo a > myfile.txt
$ hg status
? myfile.txt
$ hg add myfile.txt
$ hg status
A myfile.txt
$ hg commit -m 'Added one file'
$ hg status

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