Pull changes from your Mercurial repository on Bitbucket
- Create a Mercurial repository
- Copy your Mercurial repository and add source files
- Pull changes from your Mercurial repository on Bitbucket
- 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:
- From your BitbucketStationCrew in Bitbucket, click Source to open the source directory.
Notice you only have one file,
crew.txt, in your directory.
- A. Branch selection: Pick the branch you want to view.
- B. Source page: Click the link to open this page.
- C. New file button: Edit and create a file in Bitbucket.
- D. Source file area: View the directory of files in Bitbucket.
- 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.
- A. Branch with new file: Change if you want to add file to a different branch.
- B. New file area: Add content for your new file here.
crewrolesin the filename field .
Select HTML from the Syntax mode list.
Add the following HTML code into the text box:
<p>Bitbucket Space Station crew members:</p> <p> Emma Paris<br> <b>Quality Assurance</b> </p>
Click Commit. The Commit message field appears with the message:
crewroles created online with Bitbucket.
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 Commits in the sidebar.
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:
Open your terminal window and navigate to the top level of your local repository.
$ cd ~/repos/bitbucketstationcrew/
hg pull -ucommand 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
pulling from https://email@example.com/emmap1/bitbucketstationcrew
searching for changes
adding file changes
added 1 changesets with 1 changes to 1 files 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
hg pullcommand merges the file from your remote repository (Bitbucket) into your local repository with a single command.
- 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.