Copy your fork and make a change to the repository

このページの内容

  1. Fork a teammate's repository
  2. Copy your fork and make a change to the repository
  3. Create a pull request

Have you figured out what piece of advice you want to share with your teammates yet? Let's get a copy of the forked repository to your local system so that you can add it. Expand the section that applies to you to get started.

I'm using Git!

Step 1. Clone your fork to your local system

  1. From the forked repository in Bitbucket, click + in the global sidebar, then click Clone this repository under Get to work.
    Bitbucket displays the clone dialog. By default, the clone dialog sets the protocol to HTTPS unless you have already set up SSH for Git
    Clone your fork in Bitbucket
    • 1. Clone button: Click this button to clone a repository.
    • 2. Protocol, clone command: Pick HTTPS or SSH and copy text to the command line. 
  2. From the clone dialog, copy the highlighted clone command.
  3. From your terminal window, change the directory to your repositories directory.

    $ cd ~/repos
  4. Paste the command you copied from Bitbucket onto the command line and press Return.

  5. Enter your Bitbucket password when the terminal asks for it. This is the password you entered when you created your Bitbucket account. If you created an account by linking to Google or Facebook, use your password for that account.

    At this point, your terminal window should look similar to this:

    $ cd ~/repos
    $ git clone https://emmap1@bitbucket.org/emmap1/myteamquotes.git
    Cloning into 'myteamquotes'...
    Password
    emote: Counting objects: 15, done.
    remote: Compressing objects: 100% (15/15), done.
    remote: Total 15 (delta 4), reused 0 (delta 0)
    Unpacking objects: 100% (15/15), done.
    Checking connectivity... done.

    You now have the forked repository on your local system.

Step 2. Make a change to the repository source

This repository contains a website that has an editme.html file. This file lists inspirational quotes for your space teammates. Now, it is your turn to record an inspirational quote... or just a favorite quote. Do the following to contribute to this repository:

  1. Use Google or some other search engine to locate your favorite quote.
  2. Navigate to the directory folder containing your repository files (something like ~/repos/myteamquotes).
  3. Open the editme.html file with a text editor.
  4. Go ahead and add a quote of your choosing. You can add an image link to your quote if you like, just place it above the <blockquote> tag.

    Here is a sample of what an addition will look like:
    <!-- Please don't edit above or below this line. 
      To add a quote, copy the div below and paste it at the bottom of the file.
      Then populate it with your quote and attribution.
    
    <div class="quote">
        <blockquote>Your quote goes here</blockquote>
        <cite>Attribution</cite>
    </div>
    
      You can add an optional image tag. The image must be linked from an external
      site and not be in the repository.
    
    <img src="http://your_image_link.jpg">
    
    --Please don't edit above this line.>
    
    <div class="quote">
        <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Steve_Jobs_Headshot_2010-CROP.jpg/245px-Steve_Jobs_Headshot_2010-CROP.jpg">
        <blockquote>Put a dent in the universe.</blockquote>
        <cite>Steve Jobs</cite>
    </div>

     

    If you are not sure what to do, you can copy the example tags at the top of the file, paste them just below the last quote on the page, and modify them with your quote, as shown in the preceding example.

  5. Save and close the file.
  6. From your terminal window, change the directory to myteamquotes.

    $ cd ~/repos/myteamquotes
  7. Display the status of the repository with git status.

    $ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)
            modified:   editme.html
    no changes added to commit (use "git add" and/or "git commit -a")

    If you added an image file, you will see that file as well.

  8. Add your changes locally with git add:

    $ git add editme.html
  9. Commit your changes locally with  git commit:

    $ git commit -m "Making a change"
    [master 83bc100] Making a change
     1 file changed, 10 insertions(+), 5 deletions(-)
  10. E nter git push to push the changes to your Bitbucket fork, and enter your password to finish pushing changes.

    $ git push origin master
    Counting objects: 3, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 340 bytes | 0 bytes/s, done.
    Total 3 (delta 2), reused 0 (delta 0)
    To https://emmap1@bitbucket.org/emmap1/myteamquotes.git
       7479b42..83bc100 master -> master
    Branch master set up to track remote branch master from origin.
  11. Log into your Bitbucket repository and notice you can see your push in the activity stream.

I'm using Mercurial!

Step 1. Clone your fork to your local system

  1. From the forked repository in Bitbucket, click + in the global sidebar, then click Clone this repository under Get to work.
    Bitbucket displays the clone dialog. By default, the clone dialog sets the protocol to HTTPS unless you have already set up SSH for Git.
    • A. Clone button: Click this button to clone a repository.
    • B. Protocol, clone command: Pick HTTPS or SSH and copy text to the command line. 
  2. From the clone dialog, copy the highlighted clone command.
  3. From your terminal window, change the directory to your repositories directory.

    $ cd ~/repos
  4. Paste the command you copied from Bitbucket onto the command line and press Return.

  5. Enter your Bitbucket password when the terminal asks for it. This is the password you entered when you created your Bitbucket account. If you created an account by linking to Google or Facebook and you are following this tutorial, you should have created a password already.

    At this point, your terminal window should look similar to this:

    $ cd ~/repos
    $ hg clone https://emmap1@bitbucket.org/emmap1/myteamquotes
    realm: Bitbucket.org HTTP
    user: emmap1
    password:
    destination directory: myteamquotes
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 6449 changesets with 6858 changes to 445 files (+5 heads)
    updating to branch default
    7 files updated, 0 files merged, 0 files removed, 0 files unresolved

    You now have the forked repository on your local system.

Step 2. Make a change to the repository source

This repository contains a website which, as of this writing, has an editme.html file. This file lists inspirational quotes for your space teammates. Now, it is your turn to record an inspirational quote...or just a favorite quote. Do the following to contribute to this repository:

  1. Use Google or some other search engine to locate your favorite quote.
  2. Navigate to the directory folder containing your repository files (something like ~/repos/myteamquotes).
  3. Open the editme.html file with your preferred editor.
  4. Go ahead and add a quote of your choosing. You can add an image link to your quote if you like, just place it above the <blockquote> tag.

    Here is a sample of what an addition will look like:
    <!-- Please don't edit above or below this line. 
      To add a quote, copy the div below and paste it at the bottom of the file.
      Then populate it with your quote and attribution.
    
    <div class="quote">
        <blockquote>Your quote goes here</blockquote>
        <cite>Attribution</cite>
    </div>
    
      You can add an optional image tag. The image must be linked from an external
      site and not be in the repository.
    
    <img src="http://your_image_link.jpg">
    
    --Please don't edit above this line.>
    
    <div class="quote">
        <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Steve_Jobs_Headshot_2010-CROP.jpg/245px-Steve_Jobs_Headshot_2010-CROP.jpg">
        <blockquote>Put a dent in the universe.</blockquote>
        <cite>Steve Jobs</cite>
    </div>

     

    If you are not sure what to do, you can copy the example tags at the top of the file, paste them just below the last quote on the page, and modify them with your quote, as shown in the preceding example.

  5. Save and close the file.
  6. From your terminal window, change the directory to myteamquotes.

    $ cd ~/repos/myteamquotes
  7. Display the status of the repository with hg status.

    $ hg status
    M editme.html

    If you added an image file, you will see that file as well.

  8. Commit your changes locally with  hg commit:

    $ hg commit -m "Making a change"
  9. E nter hg push to push the changes to your Bitbucket fork, and enter your password to finish pushing changes.

    $ hg push
    pushing to https://emmap1@bitbucket.org/emmap1/myteamquotes
    realm: Bitbucket.org HTTP
    user: emmap1
    password:
    searching for changes
    remote: adding changesets
    remote: adding manifests
    remote: adding file changes
    remote: added 1 changesets with 1 changes to 1 files
  10. Log into your Bitbucket repository and notice you can see your push in the activity stream.

I'm using Sourcetree!

Step 1. Clone your fork to your local system

  1. From the Overview page of the forked repository in Bitbucket, click the Clone in Sourcetree icon.
  2. Click the Clone in Sourcetree button from the popup that appears.
  3. From the Clone New window, update the Destination Path to <local directory>/repos/myteamquotes/. This destination path refers to the repos directory you just previously created for repositories.

  4. Click the Clone button.

Step 2. Make a change to the repository source

This repository contains a website which, as of this writing, has an editme.html file. This file lists inspirational quotes for your team in space. Now, it is your turn to record an inspirational quote...or just a favorite quote. Do the following to contribute to this repository:

  1. Use Google or some other search engine to locate your favorite quote.
  2. From Sourcetree, click the Show in Finder button.
  3. Open the editme.html file with your preferred editor.
  4. Go ahead and add a quote of your choosing. You can add an image link to your quote if you like, just place it above the <blockquote> tag.

    Here is a sample of what an addition will look like:
    <!-- Please don't edit above or below this line. 
      To add a quote, copy the div below and paste it at the bottom of the file.
      Then populate it with your quote and attribution.
    
    <div class="quote">
        <blockquote>Your quote goes here</blockquote>
        <cite>Attribution</cite>
    </div>
    
      You can add an optional image tag. The image must be linked from an external
      site and not be in the repository.
    
    <img src="http://your_image_link.jpg">
    
    --Please don't edit above this line.>
    
    <div class="quote">
        <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Steve_Jobs_Headshot_2010-CROP.jpg/245px-Steve_Jobs_Headshot_2010-CROP.jpg">
        <blockquote>Put a dent in the universe.</blockquote>
        <cite>Steve Jobs</cite>
    </div>

     

    If you are not sure what to do, you can copy the example tags at the top of the file, paste them just below the last quote on the page, and modify them with your quote, as shown in the preceding example.

  5. Close and save the file.
  6. Open Sourcetree and notice that your repository has Uncommitted changes.
  7. Click the Commit button at the top to commit the file.
  8. Enter the following commit message in the space provided: "Adding new quote."
  9. Click the Commit button under the message box. When you switch back to the view, you see that the file has been committed but not pushed to the Bitbucket repository.
  10. From Sourcetree, click the Push button to push your committed changes.
  11. From the dialog box that appears, click OK to push the commit to the repository.

  12. Log into your Bitbucket repository and notice you can see your push in the activity stream.

次へ

最終更新日 2017 年 9 月 13 日

この翻訳に満足しましたか?

はい
いいえ
この記事についてのフィードバックを送信する

Not finding the help you need?

コミュニティへの質問

Powered by Confluence and Scroll Viewport.