Pull changes from your repository on Bitbucket

Next on your list of space station administrator activities, you need to file out a request for new supplies. Let's set up a system for getting supplies to our Bitbucket space station. With just a bit more knowledge of Bitbucket and Sourcetree, we'll be supporting our space exploration for years to come!

Step 1. Create a file in Bitbucket

To add your supply request file, do the following:

  1. From your BitbucketStationSupplies in Bitbucket, click Source to open the source directory.

    Notice you only have one file, supplies.txt, in your directory.

Image displaying the repository source page
  • A. Source page: Click the link to open this page.

  • B. Branch selection: Pick the branch you want to view. 

  • C. More options button: Click to open a menu with more options, such as 'Add file'.

  • D. Source file area: View the directory of files in Bitbucket. 

2. From the Source page, click the More options button in the top right corner and select Add file from the menu. The More options 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.

image of new file
  • 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.

3. Enter supplyrequest in the filename field .
4. Select HTML from the Syntax mode list.  
5. Add the following HTML code to the text area:

1 2 3 4 5 6 <p>We are requesting additional supplies. Please send us the following:</p> <ul> <li>space ice cream</li> <li>nerf darts</li> <li>telescope light shield</li> </ul>

6. Click Commit. The Commit message field appears with the message: supplyrequest 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: 

image of the new file committed

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 supply request form onto your local system. The process is pretty straight forward, basically just the reverse of the push you used to get the supplies.txt file into Bitbucket.

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

  1. Open your repository in Sourcetree, and click the Pull button.

    A popup appears to indicate that you are merging the file from Bitbucket to your local repository.

  2. Click OK from this box. Sourcetree updates with a description of the merged file.

  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 DVCS workflow (clone, add, commit, push, and pull) between Bitbucket and your local system.

Next

Additional Help