Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Latest commit

 

History

History
93 lines (79 loc) · 4.2 KB

commit-something.md

File metadata and controls

93 lines (79 loc) · 4.2 KB

Step 5: Commit a file

🎉 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

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.

Rules to live by for commit messages:

  • 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.

⌨️ Activity: Your first commit

The following steps will guide you through the process of committing a change on GitHub.

{% if preferences.gitTool == 'cli' %}

  1. Check out to your branch:
    git checkout {{ thePayload.ref }}
  2. Create a new file named _posts/0000-01-02-{{ user.username }}.md.
  3. Add the following content to your file:
    ---
    layout: slide
    title: "Welcome to our second slide!"
    ---
    Your text
    Use the left arrow to go back!
  4. Stage your new file:
    git add _posts/0000-01-02-{{ user.username }}.md
  5. 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>"
  6. Push your new commit to GitHub:
    git push

{% elsif preferences.gitTool == 'vscode' %}

  1. In the _posts folder, create a new file named 0000-01-02-{{ user.username }}.md. The full path to your file will be: _posts/0000-01-02-{{ user.username }}.md.
  2. 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!
  3. 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. a screenshot of the staging button in the source control view
  4. Commit the change by typing a commit message in the text field and pressing Ctrl+Enter on Windows or Command ⌘+Enter on macOS. a screenshot of the commit message on VS Code
  5. Click on the ellipsis (...) and select Push.

{% else %}

  1. Create a new file on this branch, in a _posts folder called 0000-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
  2. 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!
  3. 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
  4. When you’ve entered a commit message, click Commit new file {% endif %}

I'll respond when I detect a new commit on this branch.