🎉 You created a branch!
Creating a branch allows you to make modifications to your project without changing the deployed master
branch. Now that you have a branch, it’s time to create a file and make your first commit!
Commits 101
When you’re finished creating or making changes to a file on GitHub, scroll to the bottom of the page. Then find the "Commit new file" section.
In the first field, type a commit message. The commit message should briefly tell contributors about the changes you are introducing to the file.
- Don’t end your commit message with a period.
- Keep your commit messages to 50 characters or less. Add extra detail in the extended description window if necessary. This is located just below the subject line.
- Use active voice. For example, "add" instead of "added" and "merge" instead of "merged".
- Think of your commit as expressing intent to introduce a change.
The following steps will guide you through the process of committing a change on GitHub.
{% if preferences.gitTool == 'cli' %}
- Check out to your branch:
git checkout {{ thePayload.ref }}
- Create a new file named
_posts/0000-01-02-{{ user.username }}.md
. - Add the following content to your file:
--- layout: slide title: "Welcome to our second slide!" --- Your text Use the left arrow to go back!
- Stage your new file:
git add _posts/0000-01-02-{{ user.username }}.md
- After adding the text, commit the change and a commit message, check out the Commits 101 drop-down, just above these instructions:
git commit -m "<YOUR-MESSAGE>"
- Push your new commit to GitHub:
git push
{% elsif preferences.gitTool == 'vscode' %}
- In the
_posts
folder, create a new file named0000-01-02-{{ user.username }}.md
. The full path to your file will be:_posts/0000-01-02-{{ user.username }}.md
. - Add the following content to your file and save it:
--- layout: slide title: "Welcome to our second slide!" --- Your text Use the left arrow to go back!
- To stage your new file: go to the Source Control view and click the + button next to the file. You can also follow along with VS Code's official documentation.
- Commit the change by typing a commit message in the text field and pressing Ctrl+Enter on Windows or Command ⌘+Enter on macOS.
- Click on the ellipsis (...) and select Push.
{% else %}
- Create a new file on this branch, in a
_posts
folder called0000-01-02-{{ user.username }}.md
. You can do so using [this shortcut]({{ thePayload.repository.html_url }}/new/{{ thePayload.ref }}?filename=_posts/0000-01-02-{{ user.username }}.md) or manually as follows:- Return to the "Code" tab
- In the branch drop-down, select "{{ thePayload.ref }}"
- Click Create new file
- In the "file name" field, type
_posts/0000-01-02-{{ user.username }}.md
- When you’re done naming the file, add the following content to your file:
--- layout: slide title: "Welcome to our second slide!" --- Your text Use the left arrow to go back!
- After adding the text, you can commit the change by entering a commit message in the text-entry field below the file edit view. For guidelines on commit messages, check out the Commits 101 drop-down, just above these instructions
- When you’ve entered a commit message, click Commit new file {% endif %}