Search code examples
mercurialbitbucketmachg

pushing a folder to a bitbucket


I have a folder(b) inside another folder(a) which was already pushed into a repository, and i want to push folder(b) to the bitbucket using macHg but I want it to push it so in bitbucket it looks like a new folder, right now when i pushed it it just made a new head it didn't put the whole folder in there. How can I push the whole folder so on bitbucket would look like

Folder A

  • Folder B
    • file

Solution

  • If you run hg status, what do you get? You should get output like this:

    zck@zck-desktop:~/my-test$ hg status
    ? a/b/file
    

    The question mark means that mercurial doesn't know about a/b/file yet. So let's tell it to track the file. This is just a local command, nothing will hit the remote server yet.

    zck@zck-desktop:~/my-test$ hg add a/b/file
    zck@zck-desktop:~/my-test$ hg status
    A a/b/file
    

    The A means that the file was just added. Now we just need to commit (which is another local command).

    zck@zck-desktop:~/my-test$ hg commit -m "added a/b/file, with contents in it?"
    

    Finally, we need to push the changeset up to the remote server. This is the only command we've done that touches the remote server.

    zck@zck-desktop:~/my-test$ hg push