开发者

Mercurial Newbie confused

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 t开发者_JAVA技巧o 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?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜