Commit and push changes

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

  1. Set up Sourcetree
  2. Create a personal repository for the tutorial
  3. Clone your repository and manage files locally
  4. Commit and push changes

In this step you are going to make some changes to the HTML files added to your repository in Step 3. Once you make the changes and commit them you can add them to your repository on Bitbucket Data Center and Server. It's not enough to just make your changes, you have to share them with the world!

Make the changes

This step explains how to make a simple change in a source file that you'll then commit locally and push to your personal repository.

  1. Open the Teams in Space.html file in a text editor.
  2. Find the <h3>Main Menu</h3> line. Within that menu, add another list item to add a link to the itinerary on the main menu. 
    (You can copy this code and add it in your HTML file).

    <li id="menu-item-65" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-65"><a href="http://localhost:2431/?page_id=60">Moon Itinerary</a></li>
  3. Save the file.

  4. Check your work by going to the Teams in Space.html file and opening it in a web browser. It should now look something like this.

Commit and push the changes

Once you've made the changes and verified they work, you'll now commit the changes and push them to your repository.

  1. Commit the changes using Sourcetree (or the command line).
    1. From Sourcetree, click on Working Copy in the upper-left. In the Unstaged files pane on the bottom, you should see the Teams in Space.html file. 
    2. Select the checkbox to left of the file. The file moves to the Staged files pane.
    3. Click Commit in the upper-left. The Commit dialog opens at the bottom.
    4. Enter a commit message in the text field (something like "This is my first commit!" would do).
  2. Push the changes to the repository.
    1. There is now an indicator within the Branches field on the left that there are changes to push, as well as on the Push button on the top toolbar. 
    2. Click the Push button, and make sure the master branch is selected, then click Ok to push the changes.
    3. You can verify the changes were pushed by going to the repository and clicking on Commits.

Do it from the command line

Commit the files you changed to your personal repository from the command line.
From a terminal window

cd website
git commit -m "Website changes"
git push -u origin master 

Refer the below table for more details on the above commands. Learn more about how to get started with Git

Command Description
cd websiteChanges to the directory where you cloned the repository.
git commit -m "Website changes"The command git commit records the changes to the repository and the flag -m adds a comment to the commit.
git push -u origin masterThe command git push pushes your files to the master branch and the flag -u specifies the remote repository. origin is the original repository and master is the remote branch.
Last modified on Oct 27, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.