Pull changes from your repository on Bitbucket
- Create a Git or Mercurial repository
- Copy your repository and add files
- Pull changes from your repository on Bitbucket
- Use Sourcetree branches to merge an update
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:
From your BitbucketStationSupplies in Bitbucket, click Source to open the source directory.
Notice you only have one file,
supplies.txt, in your directory.
- 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.
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.
- 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.
supplyrequestin the filename field .
Select HTML from the Syntax mode list.
Add the following HTML code to the text area:
<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>
Click Commit. The Commit message field appears with the message:
supplyrequest 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 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:
Open your repository in Sourcetree, and c lick the Pull button.
A popup appears to indicate that you are merging the file from Bitbucket to your local repository.
Click OK from this box. Sourcetree updates with a description of the merged file.
- 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.