Pull changes from your Mercurial repository on Bitbucket

  1. Create a Mercurial repository
  2. Copy your Mercurial repository and add source files
  3. Pull changes from your Mercurial repository on Bitbucket
  4. Use a Mercurial bookmark to update a file

Next on your list of space station administrator activities, you need a file with more details about your space station team members. Since you don't have many team members at the moment, you are going to add them right from Bitbucket.

Step 1. Create a file in Bitbucket

To add your new team members file, do the following:

  1. From your BitbucketStationCrew in Bitbucket,  click  Source  to open the source directory.
    Notice you only have one file,  crew.txt , in your directory.

  2. From the Source page, click  New file in the top right corner. This button only appears after you have added at least one file to the repository.
    A page for creating the new file opens, as shown in the following image.

  3. Enter  crewroles  in the  filename  field .

  4. Select HTML from the Syntax mode   list.

  5. Add the following HTML code into the text box:

    <p>Bitbucket Space Station crew members:</p>
        Emma Paris<br>
        <b>Quality Assurance</b>
  6. Click Commit. The Commit message field appears with the message: crewroles created online with Bitbucket.

  7. Click Commit under the message field.

You now have a new file in Bitbucket! You are taken to a page with details of the commit, where you can see the change you just made:

If you want to see a list of the commits you've made so far, click the Commits link on the left side.

Step 2. Pull changes from a remote repository

Now we need to get that new file into your local repository. The process is pretty straight forward, basically just the reverse of the push you used to get the crew.txt file into Bitbucket.

To pull the file into your local repository, do the following:

  1. Open your terminal window and navigate to the top level of your local repository.

    $ cd ~/repos/bitbucketstationcrew/
  2. Enter the  hg pull -u  command to pull all the changes from Bitbucket. (In more complex workflows, pulling and merging all changes might not be appropriate.)  Enter your Bitbucket password when asked for it. Your terminal should look similar to the following:

    $ hg pull -u
    http authorization required for https://bitbucket.org/emmap1/bitbucketstationcrew
    realm: Bitbucket.org HTTP
    user: emmap1
    pulling from https://emmap1@bitbucket.org/emmap1/bitbucketstationcrew
    searching for changes
    adding changesets
    adding manifests
    adding file changes
    added 1 changesets with 1 changes to 1 files 1 files updated, 0 files merged, 0 files removed, 0 files unresolved

    The  hg pull  command merges the file from your remote repository (Bitbucket) into your local repository with a single command.

  3. Navigate to your repository folder on your local system and you'll see the file you just added.

Fantastic! Now, you have finished the basic Mercurial workflow (clone, add, commit, push, and pull) between Bitbucket and your local system.


Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport