Commit and push changes
- Set up Sourcetree
- Create a personal repository for the tutorial
- リポジトリをクローンしてファイルをローカルで管理する
- 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!
変更を行う
このステップでは、ソース ファイルをローカルでコミットして個人リポジトリにプッシュできるよう、ファイルに単純な変更を加えます。
- Open the
Teams in Space.html
file in a text editor. 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>
ファイルを保存します。
- 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.
変更のコミットとプッシュ
変更を行ってそれが動作することを確認したら、変更をコミットしてリポジトリにプッシュします。
- Sourcetree (またはコマンド ライン) を使用して変更をコミットします。
- 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. - ファイルの左側のチェックボックスを選択します。ファイルが [ステージング済みのファイル] ペインに移動します。
- 左上の [コミット] をクリックします。下部でコミット ダイアログが開きます。
- テキスト フィールドにコミット メッセージを入力します (例: "最初のコミット")。
- From Sourcetree, click on Working Copy in the upper-left. In the Unstaged files pane on the bottom, you should see the
- 変更をリポジトリにプッシュします。
- 左側のブランチ フィールド内にはプッシュするための変更があることを示すインジケーターが、上部のツールバーにはプッシュ ボタンが表示されます。
- [プッシュ] ボタンをクリックし、master ブランチが選択されていることを確認して、[Ok] をクリックして変更をプッシュします。
- リポジトリに移動し、[コミット] をクリックして、変更がプッシュされたことを確認します。
- 左側のブランチ フィールド内にはプッシュするための変更があることを示すインジケーターが、上部のツールバーにはプッシュ ボタンが表示されます。
コマンド ラインから実行する
変更したファイルをコマンド ラインから個人リポジトリにコミットします。
ターミナル ウィンドウで次のように実行します。
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 website | Changes 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 master | The 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. |