Monday, April 25, 2011

Mercurial(hg) started with Bitbucket Repository

The article was first published in http://confluence.atlassian.com/display/BITBUCKET/Getting+Started+with+Bitbucket



Quick guide to getting your Bitbucket repository up and running

  1. Sign up at Bitbucket.org.
  2. If you want to add a new repository on Bitbucket, click 'Create new' on your Bitbucket home screen.
  3. Get Mercurial and Python.
    (Alternatively, if you are on Windows you can download and install TortoiseHg. This bundles Python and Mercurial.)
  4. Add or edit your Mercurial config file at C:\Documents and Settings\MY_NAME\mercurial.ini (Windows XP) orC:\Users\MY_NAME\mercurial.ini (Windows 7) or ~/.hgrc (UNIX). The file should contain:
    [ui]
    ; editor used to enter commit logs, etc.  Most text editors will work.
    editor = notepad
    username = MY_FIRST_NAME MY_LAST_NAME <MY_NAME@example.com>
    
  5. Go to a directory on your local drive and clone your Bitbucket repository:
    hg clone http://bitbucket.org/MY_USER/MY_REPO
    
  6. Update your local repository:
    • Add files then enter hg add.
    • Edit files.
    • Delete files then enter hg remove.
  7. Commit your changes to the local repository:
    hg commit -m "Initial commit of all files to the repository."
    
  8. Push your changes to Bitbucket:
    hg push http://bitbucket.org/MY_USER/MY_REPO
    
  9. Have a chocolate.



P.S.  About the remove, it seems like you need to remove the file individually, for my part, I used hg status to know the change, and then append the file name after hg remove. Don't forget commit and push.


New: If you want to remove a folder with files, you could go to the parent folder, for example, folder pro3/FileRepo is the one you want to remove,  you should under pro3, and then enter "hg remove FileRepo", see hg status to see if succeed, and then commit and push.


All the "remove" I used means remove the files in Bitbucket.org Repo.

No comments:

Post a Comment