Skip to content

dongpingsheng/learngit

Repository files navigation

# Run some sand through your hands

Now is you chance to play around with this sample tutorial repository.  Since this is a sample repository, you can't do anything wrong.  Try both tasks below.  How you perform each task depends on whether you are using Sourcetree or another Git client.

- - -

## TASK 1. Clone the repository to your local machine

Cloning makes a local copy of the repository for you.  

### If you are using Sourcetree:

1. On Bitbucket, click the **SSH/HTTPS** button.

    The system selects the URL for you.
     
2. Copy the URL.
3. Open Sourcetree.
4. Click the **Add Repository** button.
5. Paste the URL in the **Source Path/URL** field.
6. Place your cursor in the **Destination Path** field.

    The system automatically completes the path for you. 

7. Verify the path is what you want.
8. Press the **Clone** button.

   Sourcetree clones your repository from Bitbucket to your local machine.

### If you are using a terminal's (Linux/OSX/GitBash) command line:

1. Click the **Clone** button in Bitbucket. 
2. Make sure the protocol is set to HTTPS.

    The system selects the command for you.
    
3. Copy the command.
4. Open a terminal on your local machine.
5. Navigate to the directory where you want your files.
6. Paste the command at the prompt.
7. Press ENTER on your keyboard.

   Git clones your repository from Bitbucket to your local machine.
    

- - -

## TASK 2. Make a change 

Make a change in the `sample.html` source file and push the change back to Bitbucket.

### If you are using Sourcetree:

1.  Double-click on your tutorial repo.
2.  Select the **Working Copy** from the left hand navigation.
3.  Select **Show All** from the dropdown.

    Sourcetree shows the files in the working tree.
    
4.  Select the **sample.html** file.
5.  Right click and choose **Open Terminal**.
6.  Using your favorite editor, edit the `sample.html` file.
7.  Change the heading from `My First File` to `Playing in the Sand`. 
8.  Save and close the file.
9.  Return to Sourcetree. 

    Sourcetree changes the file's icon to modified.
    
10.  Choose **Stage File**.
11.  Choose **Commit**.
12.  Enter a commit message.
13.  Press **Commit**.
14.  Press **Push** to send your changes to Bitbucket.
15.  After the push completes, use the **Commits** tab on Bitbucket to view your change.


### If you are using a terminal's (Linux/OSX/GitBash) command line:

1.  Go to your terminal window and navigate to the repository root.
2.  Using your favorite editor, edit the `sample.html` file.
3.  Change the heading from `My First File` to `Playing in the Sand`. 
4.  Save and close the file.
5.  Stage the file with Git.
    
    `git add sample.html`
    
6.  Commit the change.
 
    `git commit -m "changing sample.html"`
    
7. Push to Bitbucket.

    `git push`
    
    The system prompts you for a username/password.
    
8. Enter your Bitbucket accountname and the password.
9. After the push completes, use the **Commits** tab on Bitbucket to view your change.
   

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published