Commit and push changes

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

  1. Set up Sourcetree
  2. Create a personal repository for the tutorial
  3. リポジトリをクローンしてファイルをローカルで管理する
  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!

変更を行う

このステップでは、ソース ファイルをローカルでコミットして個人リポジトリにプッシュできるよう、ファイルに単純な変更を加えます。

  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. ファイルを保存します。

  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.

変更のコミットとプッシュ

変更を行ってそれが動作することを確認したら、変更をコミットしてリポジトリにプッシュします。

  1. Sourcetree (またはコマンド ライン) を使用して変更をコミットします。
    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. ファイルの左側のチェックボックスを選択します。ファイルが [ステージング済みのファイル] ペインに移動します。
    3. 左上の [コミット] をクリックします。下部でコミット ダイアログが開きます。
    4. テキスト フィールドにコミット メッセージを入力します (例: "最初のコミット")。
  2. 変更をリポジトリにプッシュします。
    1. 左側のブランチ フィールド内にはプッシュするための変更があることを示すインジケーターが、上部のツールバーにはプッシュ ボタンが表示されます。 
    2. [プッシュ] ボタンをクリックし、master ブランチが選択されていることを確認して、[Ok] をクリックして変更をプッシュします。
    3. リポジトリに移動し、[コミット] をクリックして、変更がプッシュされたことを確認します。

コマンド ラインから実行する

変更したファイルをコマンド ラインから個人リポジトリにコミットします。
ターミナル ウィンドウで次のように実行します。

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

コマンド 説明
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.
最終更新日 2022 年 11 月 8 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.