<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Ayu Adiati - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Ayu Adiati - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Wed, 13 May 2026 11:57:31 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/author/adiatiayu/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Set Up GitHub CLI on WSL2 ]]>
                </title>
                <description>
                    <![CDATA[ Recently, I set up WSL2 and Ubuntu on my Windows 11 to work on some open-source projects. Since I also maintain these projects, I installed GitHub CLI to ease my workflow. I successfully installed the GitHub CLI, but failed to authenticate it. The er... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/github-cli-wsl2-guide/</link>
                <guid isPermaLink="false">689e444cbfe79386885372b0</guid>
                
                    <category>
                        <![CDATA[ GitHub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ WSL ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Linux ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ayu Adiati ]]>
                </dc:creator>
                <pubDate>Thu, 14 Aug 2025 20:17:16 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755202477019/fbc68131-107a-40ae-9dae-c14224d0866a.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Recently, I set up WSL2 and Ubuntu on my Windows 11 to work on some open-source projects. Since I also maintain these projects, I installed <a target="_blank" href="https://cli.github.com/">GitHub CLI</a> to ease my workflow. I successfully installed the GitHub CLI, but failed to authenticate it.</p>
<p>The error message <code>failed to authenticate via web browser: Too many requests have been made in the same timeframe. (slow_down)</code> appeared on my terminal, while on the web browser, it indicated that the authentication was successful.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754718774837/0d1de969-a1e3-4f0a-a3ce-e3c4661ce0d0.png" alt="A message says &quot;Congratulations, you're all set,&quot; marking GitHub CLI authentication is successful " class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p>I googled and found some workarounds that I tried, but only one worked like a charm!</p>
<p>After finally solving the tricky authentication issue for GitHub CLI on WSL2, I've put together this guide. It's a complete walkthrough for a solution that works, covering everything from a smooth installation to ongoing management.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><p><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-install-github-cli-on-wsl2">How to Install GitHub CLI on WSL2</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-authenticate-github-cli-on-wsl2-with-your-github-account">How to Authenticate GitHub CLI on WSL2 with Your GitHub Account</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-upgrade-github-cli-on-wsl2">How to Upgrade GitHub CLI on WSL2</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-uninstall-github-cli-on-wsl2">How to Uninstall GitHub CLI on WSL2</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-how-to-revoke-github-cli-access-on-github">How to Revoke GitHub CLI Access on GitHub</a></p>
</li>
<li><p><a class="post-section-overview" href="#heading-final-words">Final Words</a></p>
</li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>Before getting started, ensure that you have these installed on your Windows machine:</p>
<ul>
<li><p>WSL2</p>
</li>
<li><p>A Linux distro</p>
</li>
<li><p>Windows PowerShell</p>
</li>
<li><p><a target="_blank" href="https://learn.microsoft.com/en-us/windows/terminal/install">Windows Terminal</a> (optional)</p>
</li>
</ul>
<p>To follow the instructions in this article, you can use Windows PowerShell terminal as an administrator.</p>
<p>Alternatively, if you have Windows Terminal installed, you can use the Linux terminal by clicking the ‘down arrow’ icon at the top and selecting the distro.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754677301223/7e846117-3fd1-42a2-ab3e-029e94672aca.png" alt="Dropdown menu at Windows Terminal" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<h2 id="heading-how-to-install-github-cli-on-wsl2">How to Install GitHub CLI on WSL2</h2>
<p>You can use the installation process described here if you use Ubuntu, Debian, or Raspberry Pi OS (apt) distros. For other distros other than those mentioned here, you can walk through the installation process that's available on the <a target="_blank" href="https://github.com/cli/cli/blob/trunk/docs/install_linux.md">GitHub CLI official docs</a>.</p>
<p>To install GitHub CLI in WSL2:</p>
<ol>
<li><p>Run this command:</p>
<pre><code class="lang-bash"> (<span class="hljs-built_in">type</span> -p wget &gt;/dev/null || (sudo apt update &amp;&amp; sudo apt install wget -y)) \
     &amp;&amp; sudo mkdir -p -m 755 /etc/apt/keyrings \
     &amp;&amp; out=$(mktemp) &amp;&amp; wget -nv -O<span class="hljs-variable">$out</span> https://cli.github.com/packages/githubcli-archive-keyring.gpg \
     &amp;&amp; cat <span class="hljs-variable">$out</span> | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg &gt; /dev/null \
     &amp;&amp; sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
     &amp;&amp; sudo mkdir -p -m 755 /etc/apt/sources.list.d \
     &amp;&amp; <span class="hljs-built_in">echo</span> <span class="hljs-string">"deb [arch=<span class="hljs-subst">$(dpkg --print-architecture)</span> signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main"</span> | sudo tee /etc/apt/sources.list.d/github-cli.list &gt; /dev/null \
     &amp;&amp; sudo apt update \
     &amp;&amp; sudo apt install gh -y
</code></pre>
</li>
<li><p>Type your Linux password when you get prompted.</p>
</li>
<li><p>Ensure the GitHub CLI is installed by running <code>gh --version</code> command. If the installation is successful, you should see something like this in your terminal:</p>
<pre><code class="lang-bash"> gh version 2.76.2 (2025-07-30)
 https://github.com/cli/cli/releases/tag/v2.76.2
</code></pre>
</li>
</ol>
<h2 id="heading-how-to-authenticate-github-cli-on-wsl2-with-your-github-account">How to Authenticate GitHub CLI on WSL2 with Your GitHub Account</h2>
<p>Before you can use GitHub CLI, you must first authenticate it. You will get an <code>HTTP 401: Bad credentials (https://api.github.com/graphql)</code> error message if you run any GitHub CLI command without authenticating.</p>
<p>To authenticate GitHub CLI with your GitHub account:</p>
<ol>
<li><p>Run the <code>gh auth login</code> command in your terminal.</p>
</li>
<li><p>You will receive several prompts, and you need to choose the methods you prefer. Here’s what I selected in each prompt:</p>
<pre><code class="lang-plaintext"> ? Where do you use GitHub? GitHub.com
 ? What is your preferred protocol for Git operations on this host? HTTPS
 ? How would you like to authenticate GitHub CLI? Login with a web browser
</code></pre>
<p> After answering all prompts, you should get the message to copy a one-time code as shown below. You <strong>don’t need to copy the code</strong> at this point.</p>
<pre><code class="lang-bash"> ! First copy your one-time code: XXXX—XXXX
</code></pre>
</li>
<li><p>Press ‘Enter’. It automatically opens the "Device Activation" page on your browser.</p>
</li>
<li><p>Click the green ‘Continue’ button.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754848322666/2a4af9ab-c197-4ec9-802f-ad9b4f24375c.png" alt="GitHub Device Activation page on a browser" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p> GitHub should ask you to enter the code displayed on your terminal, as shown in the screenshot below. But here’s the trick! <strong>Don’t paste any code, and don’t close the browser</strong>. Let’s first get back to your terminal.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754722491767/d84534da-522f-4e82-84c2-a1bfc75940ef.png" alt="GitHub Device Activation page on a browser" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<p> Now you might get this error message on your terminal:</p>
<pre><code class="lang-bash"> grep: /proc/sys/fs/binfmt_misc/WSLInterop: No such file or directory
 WSL Interopability is disabled. Please <span class="hljs-built_in">enable</span> it before using WSL.
 grep: /proc/sys/fs/binfmt_misc/WSLInterop: No such file or directory
 [error] WSL Interoperability is disabled. Please <span class="hljs-built_in">enable</span> it before using WSL.
</code></pre>
</li>
<li><p>Press <code>Ctrl + C</code> to stop the process if it's still running, or let it stop by itself. Once it's stopped, you should see this message:</p>
<pre><code class="lang-bash"> failed to authenticate via web browser: Too many requests have been made <span class="hljs-keyword">in</span> the same timeframe. (slow_down)
</code></pre>
</li>
<li><p>Run the <code>gh auth login</code> command again and repeat the process to select the methods of your choice. This time, when it asks you to press ‘Enter’, <strong>don’t press it</strong>.</p>
</li>
<li><p>Copy the latest code and return to the "Device Activation" page that you left open in your browser.</p>
</li>
<li><p>Paste the code that you copied and click the green ‘Continue’ button.</p>
</li>
<li><p>Click the green ‘Authorize github’ button after GitHub redirects you to the “Authorize GitHub CLI” page. You should now see the message “Congratulations, you're all set!”</p>
</li>
<li><p>Get back to your terminal and press ‘Enter’. Doing so triggers these actions:</p>
<ul>
<li><p>It automatically opens a new “Device Activation” page in your browser. You can safely ignore this.</p>
</li>
<li><p>In the terminal, you first see the error message as in step 4. Don’t do anything and wait for a little bit. Then, you get:</p>
<pre><code class="lang-bash">  ✓ Authentication complete.
  - gh config <span class="hljs-built_in">set</span> -h github.com git_protocol https
  ✓ Configured git protocol
  ! Authentication credentials saved <span class="hljs-keyword">in</span> plain text
  ✓ Logged <span class="hljs-keyword">in</span> as YOUR-GITHUB-USERNAME
  ! You were already logged <span class="hljs-keyword">in</span> to this account
</code></pre>
</li>
</ul>
</li>
</ol>
<p>And GitHub CLI is now successfully authenticated!</p>
<blockquote>
<p>Credit goes to <a target="_blank" href="https://github.com/cli/cli/discussions/6884#discussioncomment-10176332">username “ikeyan” on GitHub for their GitHub CLI authentication solution</a>!</p>
</blockquote>
<h2 id="heading-how-to-upgrade-github-cli-on-wsl2">How to Upgrade GitHub CLI on WSL2</h2>
<p>It’s always a good practice to regularly check for package and dependency updates, and upgrade to the newest version when it’s available — this includes GitHub CLI. To check for updates and upgrade the version of GitHub CLI:</p>
<ol>
<li><p>Run the <code>sudo apt update</code> command in your terminal. This command fetches the list of available updates.</p>
</li>
<li><p>Type your Linux password when you get prompted.</p>
</li>
<li><p>If you need to upgrade your GitHub CLI, run <code>sudo apt install gh</code>. This command installs the newest version of GitHub CLI.</p>
</li>
<li><p>Type your Linux password when you get prompted.</p>
</li>
</ol>
<p>Now your GitHub CLI has the newest version.</p>
<h2 id="heading-how-to-uninstall-github-cli-on-wsl2">How to Uninstall GitHub CLI on WSL2</h2>
<p>If one day you feel like you don’t need to use GitHub CLI anymore, you can uninstall it by following these steps:</p>
<ol>
<li><p>Run the <code>sudo apt remove gh</code> command in your terminal.</p>
</li>
<li><p>Type your Linux password when you get prompted.</p>
</li>
<li><p>Press ‘Y’ to continue the uninstall process.</p>
</li>
</ol>
<p>GitHub CLI is now uninstalled from your WSL environment.</p>
<h2 id="heading-how-to-revoke-github-cli-access-on-github">How to Revoke GitHub CLI Access on GitHub</h2>
<p>After uninstalling the GitHub CLI, you might think your account access is gone, but it's not. The authentication you granted is still active. If you don't plan on using the CLI again, it's a good practice to revoke this access.</p>
<p>Here's how to do it directly from your GitHub account:</p>
<ol>
<li><p>On your GitHub account, click your profile picture on the top right and click ‘Settings’.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754725091482/8fb8a0fd-8dbd-4342-9fe8-309a13d72c39.png" alt="Settings option on dropdown menu at GitHub" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
<ol start="2">
<li><p>On the left side bar, find ‘Integrations’ and click ‘Applications’.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754815240842/ca49d207-6ee2-476f-a53d-bde53b2d57dd.png" alt="Applications tab in the Integrations settings on GitHub" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
</li>
<li><p>Click the ‘Authorized OAuth Apps’ tab on top.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754815346304/a360f7dc-7024-44c3-8e19-15d94b35ce8e.png" alt="Authorized OAuth Apps tab on GitHub" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
</li>
<li><p>Find GitHub CLI and click the ‘three dots’ icon next to it.</p>
</li>
<li><p>Click ‘Revoke’.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754725454783/dd544380-482a-4385-97c1-4ebc35026658.png" alt="Revoke option on GitHub to revoke an authorized OAuth apps" class="image--center mx-auto" width="600" height="400" loading="lazy"></p>
</li>
<li><p>Confirm it by clicking the ‘I understand, revoke access’ button.</p>
</li>
</ol>
</li>
</ol>
<p>Now, GitHub CLI doesn’t have access to your GitHub account.</p>
<hr>
<h2 id="heading-final-words">Final Words</h2>
<p>🖼️ Credit cover image: <a target="_blank" href="http://undraw.co">undraw.co</a></p>
<p>Thank you for reading! Last, you can find me on <a target="_blank" href="https://twitter.com/@AdiatiAyu">X</a> and <a target="_blank" href="https://www.linkedin.com/in/adiatiayu/">LinkedIn</a>. Let's connect! 😊</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Add a Table of Contents to Your Article on Ghost ]]>
                </title>
                <description>
                    <![CDATA[ A table of contents (or TOC) is a list of chapters or section titles in an article. You'll usually find it at the beginning of an article, right after the introduction. When you write a long blog post or an article with independent sections, consider... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-add-a-table-of-contents-to-your-article-on-ghost/</link>
                <guid isPermaLink="false">66ba11df64fe3b6039f992a8</guid>
                
                    <category>
                        <![CDATA[ Ghost ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technical writing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ writing ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ayu Adiati ]]>
                </dc:creator>
                <pubDate>Fri, 01 Dec 2023 19:47:28 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/11/How-to-Add-a-Table-of-Contents-to-Your-Article-on-Ghost-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>A table of contents (or TOC) is a list of chapters or section titles in an article. You'll usually find it at the beginning of an article, right after the introduction.</p>
<p>When you write a long blog post or an article with independent sections, consider adding a table of contents. It can help your readers understand your article's content and know what's coming. Providing hyperlinks to each title in the table of contents helps readers navigate between the sections they want to check out.</p>
<p>Having a table of contents in your articles also benefits you as a writer. First, you can easily see the flow of your article. Another benefit is that it can increase your blog's traffic. If your readers have a great experience reading your article, they will likely bookmark and return to it.</p>
<p>Some publications use <a target="_blank" href="https://ghost.org/">Ghost</a> to write and publish articles on their website, and freeCodeCamp is one of them. In this article, I will walk you through how to add a clickable table of contents to your article on Ghost.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
    <li><a href="#understanding-headings">Understanding Headings</a></li>
    <li><a href="#how-to-add-a-table-of-contents">How to Add a Table of Contents</a>
        <ul>
            <li><a href="#step-1-create-a-list-of-headings">Step #1 - Create a List of Headings</a>
                <ul>
                    <li><a href="#create-a-list-of-one-level-headings">Create a List of One-Level Headings</a></li>
                    <li><a href="#create-a-list-with-subheadings">Create a List with Subheadings</a></li>
                </ul>
            </li>
            <li><a href="#step-2-inspect-a-heading-and-find-the-id">Step #2 - Inspect a Heading and Find the <code>id</code></a></li>
            <li><a href="#step-3-add-the-link">Step #3 - Add the Link</a>
                <ul>
                    <li><a href="#add-a-link-to-a-heading">Add a Link to a Heading</a></li>
                    <li><a href="#add-a-link-to-a-heading-in-html">Add a Link to a Heading in HTML</a></li>
                    <li><a href="#why-does-the-link-not-work">Why Does the Link Not Work?</a></li>
                </ul>
            </li>
        </ul>
    </li>
    <li><a href="#final-words">Final Words</a></li>
</ul>

<h2 id="heading-understanding-headings">Understanding Headings</h2>
<p>Before we jump into how to add a table of contents, let's take a moment to understand "headings" because I will use this term going forward.</p>
<blockquote>
<p>Headings are titles of sections and subsections that are displayed on a website.</p>
</blockquote>
<p>There are six levels of headings based on the importance of the section.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/h1-h6.png" alt="Image" width="600" height="400" loading="lazy">
<em>Levels of headings – H1 - H6</em></p>
<p>Following best practices, a page on a website should only have one <code>heading level 1</code> (known as <code>h1</code>). It is the main title of the page. In your case, it'll be the main title of your article. (In this article, it's "How to Add a Table of Contents to Your Article on Ghost".)</p>
<p>So, writing an article on Ghost (or any other publication platform) leaves you with <code>h2</code> to <code>h6</code> for your section and subsection titles. And you can use as many of them as you need depending on the hierarchy and organization of your content.</p>
<h2 id="heading-how-to-add-a-table-of-contents">How to Add a Table of Contents</h2>
<p>You can create your table of contents whenever you want – before you write, during the process, or after you finish writing your article. </p>
<p>But you can only add the link to each chapter or section title after writing your article. This is because you'll need to know exactly how the text of the headings will appear in order to link to them properly, as you'll see below.</p>
<p>In this guide, I'll show you how to build a ToC in HTML, which allows you to add subheadings in addition to main headings/section titles. </p>
<h3 id="heading-step-1-create-a-list-of-headings">Step #1 - Create a List of Headings</h3>
<p>You can create a table of contents with a <a class="post-section-overview" href="#heading-create-a-list-of-one-level-headings-2">list of one-level headings</a> (<code>h2</code>) or <a class="post-section-overview" href="#heading-create-a-list-with-subheadings-2">include the subheadings</a> (<code>h3</code> to <code>h6</code>) if you want to.</p>
<p>You can also choose how you want to format your list:</p>
<ul>
<li><strong>Unordered List</strong>:  A list with bullet points.</li>
<li><strong>Ordered List</strong>: A list with numbers.</li>
</ul>
<h4 id="heading-create-a-list-of-one-level-headings">Create a List of One-Level Headings</h4>
<p>Follow these steps to create a one-level headings list:</p>
<ol>
<li>Insert a new line.</li>
<li>Type a dash (<code>-</code>) or an asterisk (<code>*</code>) for the unordered list. Or, type a number and add a period — for example, <code>1.</code> — for the ordered list.</li>
<li>Hit the spacebar.</li>
<li>Add the title.</li>
<li>Click enter to add a new item in the list.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/add-list-ghost.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Add an unordered and an ordered list.</em></p>
<p><strong>Note</strong>: You can skip the next section and go directly to "<a class="post-section-overview" href="#heading-step-2-inspect-a-heading-and-find-the-id-1">Step #2 - Inspect a Heading and Find the <code>id</code></a>" if you want.</p>
<h4 id="heading-create-a-list-with-subheadings">Create a List with Subheadings</h4>
<p>If you wish to create a list with subheadings (nested list), you must use HTML to format it manually, as Ghost doesn't have nested list options built into the editor.</p>
<p>First, you need to add the HTML card:</p>
<ol>
<li>Start on a new line.</li>
<li>When your cursor is on the new line, you will see a plus (<code>+</code>) icon button in the circle on the left. Click this button.</li>
<li>Click the "HTML" option.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/ghost-primary-option-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>A plus sign and an "HTML" option on Ghost.</em></p>
<p>Afterward, you will see the HTML card, as shown in the image below.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/ghost----html-card.png" alt="Image" width="600" height="400" loading="lazy">
<em>HTML card on Ghost.</em></p>
<p>Now, let's start adding the list of your headings and subheadings.</p>
<p>Add an HTML unordered list (<code>&lt;ul&gt;&lt;/ul&gt;</code>) or an ordered list (<code>&lt;ol&gt;&lt;/ol&gt;</code>) element.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>

or

<span class="hljs-tag">&lt;<span class="hljs-name">ol</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ol</span>&gt;</span>
</code></pre>
<p>To add the list of your headings, add a space between the <code>ul</code> or <code>ol</code> tags. Put the cursor between the tags and hit enter twice.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>Then, add list elements (<code>&lt;li&gt;&lt;/li&gt;</code>) in the empty line between the opening and closing <code>ul</code> or <code>ol</code> tags. Add these list elements based on the number of your section titles.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>Afterward, put each of the titles between the <code>li</code> tags.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 2 - Part 1<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 2 - Part 2<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 2 - Part 3<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>To add subheadings, repeat all the steps. But now, you should put the <code>ul</code> or <code>ol</code> element inside the <code>li</code> element(s) that hold the section title. Here's how to do it:</p>
<ol>
<li>Place your cursor between the end of the section title and the <code>&lt;/li&gt;</code> tag, then click enter.</li>
<li>Click enter again to add a space and add an <code>ul</code> or <code>ol</code> element for the subheadings.</li>
<li>Add an <code>ul</code> or <code>ol</code> element in the new line, put the cursor between the tags, and hit enter twice to add a space.</li>
<li>Add <code>li</code> element(s) in the new line between the <code>ul</code> or <code>ol</code> tags.</li>
<li>Put the subsection title between the <code>li</code> tags.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/walkthrough-nested-list.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Creating a nested list in HTML.</em></p>
<p>Below is an example of a table of contents with subheadings in HTML.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 2 - Part 1
        <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 3<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 3<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 2 - Part 2
        <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 3
                <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
                    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 4<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
                <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>Heading 2 - Part 3<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>And the result will look like this:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/ghost----HTML-result.png" alt="Image" width="600" height="400" loading="lazy">
<em>A list of section and subsection titles.</em></p>
<h3 id="heading-step-2-inspect-a-heading-and-find-the-id">Step #2 - Inspect a Heading and Find the <code>id</code></h3>
<p>After creating the list, it's time to add the links to the titles in your table of contents.</p>
<p>But first, you need to find the <code>id</code> attribute of your heading using preview mode by inspecting the title with your browser's (Chrome or Firefox) developer tools.</p>
<p>So, let's open your preview mode:</p>
<ol>
<li>Click the gear icon on the top right of your Ghost editor.</li>
<li>Click the "Preview" link beside the "Post URL" input.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/ghost-preview-link.png" alt="Image" width="600" height="400" loading="lazy">
<em>The "Preview" link is in the "Post settings" on Ghost.</em></p>
<p>Now that you are in the preview mode, right-click your mouse. You will see some options. Click the "Inspect" option to open the developer tools.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/developer-tools-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>"Inspect" option on Chrome.</em></p>
<p>In the developer tools, let's click the button with a box and arrow icon on the top left to select a heading element on the page and inspect it.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/select-element-tool.png" alt="Image" width="600" height="400" loading="lazy">
<em>"Select an element in the page to inspect it" button in the developer tools on Chrome.</em></p>
<p>Hover over a title and click on it. It will highlight the element you want to inspect in the developer tools. Inside the heading element (<code>h2</code> to <code>h6</code>), you will see an <code>id</code> (shown with a red line in the image below).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/inspect-elelemet-devtool.png" alt="Image" width="600" height="400" loading="lazy">
<em>Inspect a heading with developer tools on Chrome.</em></p>
<p>Double-click on the value inside the quote marks of the <code>id</code> and copy it. You will use it to add the link to the title in the table of contents.</p>
<p><strong>Note</strong>: </p>
<ul>
<li>If you <a class="post-section-overview" href="#heading-create-a-list-of-one-level-headings-2">created a list of one-level headings</a>, head to the "<a class="post-section-overview" href="#heading-add-a-link-to-a-heading-1">Add a Link to a Heading</a>" section.</li>
<li>If you <a class="post-section-overview" href="#heading-create-a-list-with-subheadings-2">made a list with subheadings</a>, go to the "<a class="post-section-overview" href="#heading-add-a-link-to-a-heading-in-html-1">Add a Link to a Heading in HTML</a>" section.</li>
</ul>
<h3 id="heading-step-3-add-the-link">Step #3 - Add the Link</h3>
<h4 id="heading-add-a-link-to-a-heading">Add a Link to a Heading</h4>
<p>To add the link, return to your table of contents in the Ghost editor. Then, follow these steps:</p>
<ol>
<li>Highlight the title that you want to add the link to.</li>
<li>Click the chain icon.</li>
<li>Type a hashtag (<code>#</code>) in the input field and paste your copied <code>id</code> value.</li>
</ol>
<p>So, it will be like this:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/ghost-highlight-title.png" alt="Image" width="600" height="400" loading="lazy">
<em>Highlighting a list and a chain icon on Ghost.</em></p>
<pre><code class="lang-markdown"><span class="hljs-section">#understanding-headings</span>
</code></pre>
<p>After you refresh the preview page, check if the link works. It should take you to the target section when you click the title's link. If not, read the "<a class="post-section-overview" href="#heading-why-does-the-link-not-work-1">Why Does the Link Not Work?</a>" section.</p>
<h4 id="heading-add-a-link-to-a-heading-in-html">Add a Link to a Heading in HTML</h4>
<p>First, let's return to your Ghost editor and go to the <code>li</code> element that holds the title in the table of contents.</p>
<p>Then, wrap the title inside an anchor element (<code>&lt;a&gt;&lt;/a&gt;</code>) and add <code>href=""</code> attribute in the opening tag.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">""</span>&gt;</span>Understanding Headings<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>The anchor element creates a hyperlink, and the <code>href</code> attribute is the placeholder for the link's destination.</p>
<p>Now, you will add the link's destination. Type a hashtag (<code>#</code>) and paste the <code>id</code> value you've copied inside the double quotes of the <code>href</code>.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#understanding-headings"</span>&gt;</span>Understanding Headings<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>Repeat all the steps to add a link for each title.</p>
<p>Below is an example of section and subsection titles with links in HTML:</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#understanding-headings"</span>&gt;</span>Understanding Headings<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#adding-a-table-of-content"</span>&gt;</span>Adding a Table of Content<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"#step-1-create-a-list-of-titles"</span>&gt;</span>Step #1 - Create a List of Titles<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre>
<p>After refreshing the preview page, you can now check if the link works by clicking it. If it doesn't work, read the next section.</p>
<h4 id="heading-why-does-the-link-not-work">Why Does the Link Not Work?</h4>
<p>If you click a link in your table of contents and it goes nowhere or redirects you to a "404 Page not found", return to the preview page. Refresh it, and try to click the link again.</p>
<p>If it still does the same, you need to check the link in the Ghost editor.</p>
<p>Sometimes, it can be a typo where you change the title but still need to update the link. Or there is a missing hashtag (<code>#</code>) in the link.</p>
<h2 id="heading-final-words"><strong>Final Words</strong></h2>
<p>If you liked and found this article helpful, please share it with others. You can find other works on my <a target="_blank" href="https://adiati.com/">blog</a>. Let's connect on <a target="_blank" href="https://twitter.com/@AdiatiAyu">X (formerly Twitter)</a> or <a target="_blank" href="https://www.linkedin.com/in/adiatiayu/">LinkedIn</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Keep Branches Up-to-Date and Resolve Merge Conflicts in GitHub and VS Code ]]>
                </title>
                <description>
                    <![CDATA[ Hey {username}, we've merged a PR before yours. Please resolve the merge conflicts so we can review and merge your PR. Have you ever received that kind of message from a maintainer while waiting for your pull request to be reviewed and merged? And t... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/keep-branches-up-to-date-resolve-merge-conflicts/</link>
                <guid isPermaLink="false">66ba11e57282cc17abcf0c71</guid>
                
                    <category>
                        <![CDATA[ beginner ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GitHub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ open source ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Visual Studio Code ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ayu Adiati ]]>
                </dc:creator>
                <pubDate>Wed, 22 Nov 2023 23:23:20 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/11/How-to-Keep-Branches-Up-to-Date-and-Resolve-Merge-Conflicts-in-GitHub-and-VS-Code.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <blockquote>
<p>Hey {username}, we've merged a PR before yours. Please resolve the merge conflicts so we can review and merge your PR.</p>
</blockquote>
<p>Have you ever received that kind of message from a maintainer while waiting for your pull request to be reviewed and merged? And then, you're panicking because you don't know what to do? Or maybe you're thinking of closing your pull request, redoing everything from scratch, and opening a new pull request?</p>
<p>Well, the good news is you're not alone.</p>
<p>In this article, I will show you how to keep your remote and local branches up to date. I'll also walk you through resolving merge conflicts in GitHub and VS Code.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
    <li><a href="#prerequisites">Prerequisites</a></li>
    <li><a href="#understanding-merge-conflicts">Understanding Merge Conflicts</a></li>
    <li>
        <a href="#how-to-keep-the-branches-up-to-date">How to Keep the Branches Up to Date</a>
        <ul>
            <li><a href="#how-to-update-the-main-branch-in-your-forked-repository">How to Update the <code>main</code> Branch in Your Forked Repository</a></li>
            <li><a href="#how-to-update-your-local-branch">How to Update Your Local Branch</a></li>
        </ul>
    </li>
    <li>
        <a href="#how-to-resolve-merge-conflicts">How to Resolve Merge Conflicts</a>
        <ul>
            <li><a href="#1-resolving-merge-conflicts-on-github">1. Resolving Merge Conflicts on GitHub</a></li>
            <li><a href="#2-resolving-merge-conflicts-in-vs-code">2. Resolving Merge Conflicts in VS Code</a></li>
        </ul>
    </li>
    <li><a href="#final-words">Final Words</a></li>
</ul>

<h2 id="heading-prerequisites"><strong>Prerequisites</strong></h2>
<p>To follow along with this tutorial, you'll need the following:</p>
<ul>
<li>A <a target="_blank" href="https://github.com/">GitHub</a> account.</li>
<li><a target="_blank" href="https://code.visualstudio.com/">VS Code</a> installed on your machine.</li>
</ul>
<h2 id="heading-understanding-merge-conflicts">Understanding Merge Conflicts</h2>
<p>Merge conflicts usually occur when two commits have changes in the same line(s) of the same file(s) from two different branches. Sometimes, it can also happen when someone edits a file, and another person deletes it. </p>
<p>The thing is, Git can't resolve the conflict itself. It needs your help to decide which changes need to be kept.</p>
<p>When there's a merge conflict, you will see a notification in your pull request on GitHub that the branch has conflicts that must be resolved. Maintainers can't merge a pull request when merge conflicts happen. That's because the merge button is deactivated until the conflicts are resolved.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/branch-has-conflicts.png" alt="Image" width="600" height="400" loading="lazy">
<em>Warning on a GitHub's pull request: This branch has conflicts that must be resolved</em></p>
<h2 id="heading-how-to-keep-the-branches-up-to-date">How to Keep the Branches Up to Date</h2>
<p>Keeping your branches up to date is crucial. Habitually updating your remote and local <code>main</code> and working branches is highly recommended.</p>
<p>The best times to update your branches are:</p>
<ul>
<li>before you create a new branch to work on an issue,</li>
<li>after you commit your last changes and before you push them to the remote repo,</li>
<li>while you are waiting for your pull request to be reviewed.</li>
</ul>
<p>When a pull request gets merged while you wait for yours to be reviewed, there will be a warning in your pull request. It tells you that your branch is behind the <code>upstream</code> (original) repository's <code>main</code> branch.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/branch-out-of-date.png" alt="Image" width="600" height="400" loading="lazy">
<em>Warning on a GitHub pull request: This branch is out-of-date with the base branch.</em></p>
<h3 id="heading-how-to-update-the-main-branch-in-your-forked-repository">How to Update the <code>main</code> Branch in Your Forked Repository</h3>
<ol>
<li>Go to your forked repository on GitHub.</li>
<li>Click the "Sync fork" button.</li>
<li>Click the green "Update branch" button.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/update-branch.png" alt="Image" width="600" height="400" loading="lazy">
<em>"Sync fork" and "Update branch" buttons on GitHub.</em></p>
<p>After you update the branch, you will see a notification on the top that your branch is up to date.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/up-to-date-branch-github.png" alt="Image" width="600" height="400" loading="lazy">
<em>A notification on GitHub: This branch is up to date with organization-name/repository-name:main.</em></p>
<h3 id="heading-how-to-update-your-local-branch">How to Update Your Local Branch</h3>
<p>Now, your remote <code>main</code> branch has been updated. Let's update your local branch from your terminal.</p>
<h4 id="heading-step-1-go-to-your-working-branch">Step #1 - Go to Your Working Branch</h4>
<p>In your terminal, navigate to your working branch with this command:</p>
<pre><code class="lang-bash">git checkout branch-name
</code></pre>
<h4 id="heading-step-2-pull-the-changes">Step #2 - Pull the Changes</h4>
<p>Pull the latest changes from the <code>main</code> branch of your <code>origin</code> (forked) repository to your local branch.</p>
<pre><code class="lang-bash">git pull origin main
</code></pre>
<h4 id="heading-step-3-push-the-changes">Step #3 - Push the Changes</h4>
<p>Push these changes to your remote branch. If you need to resolve conflicts, you must fix them before you can push your changes<em>.</em></p>
<pre><code class="lang-bash">git push
</code></pre>
<h2 id="heading-how-to-resolve-merge-conflicts">How to Resolve Merge Conflicts</h2>
<p>You can only start to resolve the merge conflicts after your working branch is up to date. There are two ways to resolve the conflicts:</p>
<ol>
<li>On GitHub</li>
<li>In your VS Code</li>
</ol>
<h3 id="heading-1-resolving-merge-conflicts-on-github">1. Resolving Merge Conflicts on GitHub</h3>
<p>Resolving the conflicts directly on GitHub is only possible when the cause of the conflicts is that there are changes in the same line(s) of the same file(s) from two different branches. For any other type of conflicts, you must resolve them locally in your code editor.</p>
<p>Follow these steps to resolve conflicts directly on GitHub:</p>
<h4 id="heading-step-1-click-the-resolve-conflicts-button">Step #1 - Click the "Resolve conflicts" Button</h4>
<p>First, go to the <code>upstream</code> repository on GitHub. Then, click the "Pull request" tab. Find and open your pull request, and scroll down.</p>
<p>Towards the end, you will find the "Resolve conflicts" button.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/resolved-conflicts-button.png" alt="Image" width="600" height="400" loading="lazy">
<em>A notification of "This branch has conflicts that must be resolved" and a "Resolve conflicts" button on GitHub.</em></p>
<h4 id="heading-step-2-take-a-closer-look-at-the-conflicts">Step #2 - Take a Closer Look at the Conflicts</h4>
<p>After clicking the "Resolve conflicts" button, you will be redirected to GitHub's conflict editor.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/github-resolve-conflict-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>GitHub's conflict editor</em></p>
<p>You can see the file(s) that has conflicts on the left sidebar. On the top bar, you can find the number of conflicts in the file. And in the file itself, there are conflict markers <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code>, <code>=======</code>, and <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code>.</p>
<p>The lines between <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; branch-name</code> and <code>=======</code> are your changes. Anything between <code>=======</code> and <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt; main</code> are the changes from the <code>main</code> branch of the <code>upstream</code> repository.</p>
<p>You need to look at the conflicts and decide which one you want to keep or if you need to make entirely new changes.</p>
<h4 id="heading-step-3-resolving-the-conflicts">Step #3 - Resolving the Conflicts</h4>
<p>After you decide how you want to resolve the conflicts, delete the conflict markers <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code>, <code>=======</code>, <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code>. Then you can make the changes. If there are several conflicts in the file, scroll down and resolve them before you mark them as resolved.</p>
<p>Once you resolved all conflicts, click the "Mark as resolved" button at the top bar.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/mark-as-resolved.png" alt="Image" width="600" height="400" loading="lazy">
<em>"Mark as resolved" button on GitHub.</em></p>
<p>If there are conflicts in another file(s), go to the file by clicking the file name at the left sidebar. And then repeat the same steps to resolve the conflicts.</p>
<h4 id="heading-step-4-click-the-commit-merge-button">Step #4 - Click the "Commit merge" Button</h4>
<p>After all conflicts in all conflicting files have been marked as resolved, a green "Commit merge" button will appear on the top right. Click the button to commit your changes.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/commit-merge-btn.png" alt="Image" width="600" height="400" loading="lazy">
<em>A "Commit merge" button on GitHub.</em></p>
<h3 id="heading-2-resolving-merge-conflicts-in-vs-code">2. Resolving Merge Conflicts in VS Code</h3>
<p>After you pulled the latest changes from the <code>main</code> branch of your forked repository, you will see line(s) between the conflict markers <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code>, <code>=======</code>, and <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code>.</p>
<p>You will also see the options for resolving the conflicts:</p>
<ul>
<li><strong>Accept Current Change</strong>: When you want to keep only your changes.</li>
<li><strong>Accept Incoming Change</strong>: When you want to keep only the changes from the <code>main</code> branch.</li>
<li><strong>Accept Both Changes</strong>: When you wish to keep yours and the incoming changes.</li>
</ul>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/11/merge-conflicts-vscode.png" alt="Image" width="600" height="400" loading="lazy">
<em>Merge conflicts on VS Code.</em></p>
<p>The line(s) between <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD (Current Change)</code> and <code>=======</code> are your changes. And anything between <code>=======</code> and <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt; hash-numbers (Incoming Change)</code> are changes from the <code>main</code> branch of your forked repository.</p>
<p>Follow these steps to resolve the conflicts in VS Code:</p>
<h4 id="heading-step-1-resolving-the-conflicts">Step #1 - Resolving the Conflicts</h4>
<p>Take a closer look at the conflicts between the conflict markers. Then, you need to decide how you want to resolve the conflicts.</p>
<ul>
<li>You can manually delete the markers <code>&lt;&lt;&lt;&lt;&lt;&lt;&lt;</code>, <code>=======</code>, <code>&gt;&gt;&gt;&gt;&gt;&gt;&gt;</code> and make the changes.</li>
</ul>
<p><strong>OR</strong></p>
<ul>
<li>You can choose and click one of the acceptance options on the top and modify the changes based on your needs.</li>
</ul>
<h5 id="heading-undo-the-merging">Undo the Merging</h5>
<p>If at one point you feel confused and want to undo the merge and redo everything from scratch, run the <code>git merge --abort</code> command before committing your changes. It will abort the merge and return your file to the state before the conflicts.</p>
<h4 id="heading-step-2-commit-your-changes">Step #2 - Commit Your Changes</h4>
<p>Once you finished resolving the conflicts, you must commit your changes. Run this command to automatically stage and commit the changes:</p>
<pre><code class="lang-bash">git commit -am <span class="hljs-string">"Your message"</span>
</code></pre>
<h5 id="heading-understanding-git-commit-am-command">Understanding <code>git commit -am</code> Command</h5>
<p>The command <code>git commit -am</code> is different from running <code>git add .</code> followed by <code>git commit -m</code>.</p>
<p>Running <code>git add .</code> will add <em>all</em> files (including newly created files) to the staging area. While adding the <code>-a</code> flag to the <code>git commit</code>, it will automatically stage any files you have committed before. It includes staging deleted tracked files but will not stage newly created files.</p>
<p>So, combining the <code>-a</code> with <code>-m</code> flag to <code>git commit</code> allows you to skip the staging phase and directly write the message for the commit.</p>
<h4 id="heading-step-3-push-your-changes">Step #3 - Push Your Changes</h4>
<p>Now, you can push your changes to the remote branch with the following command:</p>
<pre><code class="lang-bash">git push
</code></pre>
<h2 id="heading-final-words">Final Words</h2>
<p>If you liked and found this article helpful, please share it with others. You can find other works on my <a target="_blank" href="https://adiati.com/">blog</a>, and let's connect on <a target="_blank" href="https://twitter.com/@AdiatiAyu">X (formerly Twitter)</a> or <a target="_blank" href="https://www.linkedin.com/in/adiatiayu/">LinkedIn</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Contribute to Open-Source Projects – Git & GitHub Workflow for Beginners ]]>
                </title>
                <description>
                    <![CDATA[ The first time I learned about open source was through a tweet that promoted Hacktoberfest in 2019. And my first-ever accepted pull request was to add a book title in emojis to a list. You might think, "You can't count that as an open source contribu... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/git-and-github-workflow-for-open-source/</link>
                <guid isPermaLink="false">66ba11dd7282cc17abcf0c6f</guid>
                
                    <category>
                        <![CDATA[ beginners guide ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Git ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GitHub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ open source ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ayu Adiati ]]>
                </dc:creator>
                <pubDate>Fri, 22 Sep 2023 12:35:14 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/09/Git---GitHub-Workflow-for-Beginners.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The first time I learned about open source was through a tweet that promoted Hacktoberfest in 2019. And my first-ever accepted pull request was to add a book title in emojis to a list.</p>
<p>You might think, "You can't count that as an open source contribution. That's a joke!"</p>
<p>I had the same thought myself — until recently. Getting my feet wet in open source was daunting, yet I got through it. And looking back, I learned a ton from that first contribution.</p>
<p>As a newbie who didn't know anything about open source, I learned how to communicate with the maintainers, how to work with Git and GitHub, and how to create a pull request. It was a big learning curve!</p>
<p>That is one of the reasons why I wrote this guide: to make your journey in contributing to open-source projects smoother and less daunting.</p>
<p>In this guide, I'll walk you through the basic Git and GitHub workflow when contributing to open-source projects. I'll also explain how to synchronize your forked and local repositories with the original repository and how to resolve merge conflicts when you encounter one.</p>
<p>Without further ado, let's get started!</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a class="post-section-overview" href="#heading-prerequisites">Prerequisites</a></li>
<li><a class="post-section-overview" href="#heading-are-all-github-projects-open-source">Are all GitHub Projects Open Source?</a></li>
<li><a class="post-section-overview" href="#heading-how-to-fork-a-repository">How to Fork a Repository</a></li>
<li><a class="post-section-overview" href="#heading-how-to-clone-a-repository">How to Clone a Repository</a></li>
<li><a class="post-section-overview" href="#heading-how-to-create-a-new-branch">How to Create a New Branch</a></li>
<li><a class="post-section-overview" href="#heading-how-to-add-changes-to-the-staging-area">How to Add Changes to the Staging Area</a></li>
<li><a class="post-section-overview" href="#heading-how-to-commit-changes">How to Commit Changes</a></li>
<li><a class="post-section-overview" href="#heading-how-to-synchronize-changes">How to Synchronize Changes</a></li>
<li><a class="post-section-overview" href="#heading-how-to-resolve-merge-conflicts">How to Resolve Merge Conflicts</a></li>
<li><a class="post-section-overview" href="#heading-how-to-push-changes">How to Push Changes</a></li>
<li><a class="post-section-overview" href="#heading-how-to-create-a-pull-request">How to Create a Pull Request</a></li>
<li><a class="post-section-overview" href="#heading-final-words">Final Words</a></li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>To follow along with this tutorial, you'll need the following:</p>
<ul>
<li>A <a target="_blank" href="https://github.com/">GitHub</a> account.</li>
<li>A code editor like <a target="_blank" href="https://code.visualstudio.com/">VSCode</a> installed on your machine.</li>
</ul>
<h2 id="heading-are-all-github-projects-open-source">Are all GitHub Projects Open Source?</h2>
<p>When you're interested in making contributions, you should make sure that the project you're interested in is open source. You can't assume that all projects on GitHub are open source.</p>
<p>In this section, I will share what you should check to know if a project is open source.</p>
<h3 id="heading-the-license">The License</h3>
<p>The license is the first thing you want to check. A project on GitHub is not an open source unless it has a license.</p>
<p>In most jurisdictions, a project without a license is automatically licensed as "All Rights Reserved" by its owner. It means that no one may use, modify, or redistribute anything in the project without the permission of the owner. If you ignore it, they can legally sue you.</p>
<p>You can find the license in a file called <code>LICENSE</code>. You'd usually see in the "About" section of the repository.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/repo-about-section-github-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>An MIT license in the "About" section on the right sidebar of a repository on GitHub</em></p>
<h3 id="heading-the-contribution-guide">The Contribution Guide</h3>
<p>Most open-source projects are ready to receive contributions when it has a contribution guide. This guide contains everything you should know about how to contribute to the project, from opening an issue to creating a pull request. From the code of conduct to the expected communication style.</p>
<p>The procedures and requirements for contributing to open-source projects may differ from one to another. You always want to read and follow the guide when contributing to a project.</p>
<p>Usually, you'll find a section about the contributing guide on the README. But if you can't find it there, look for a file called <code>CONTRIBUTING.md</code> or anything similar.</p>
<h3 id="heading-hacktoberfest-topic">Hacktoberfest Topic</h3>
<p><a target="_blank" href="https://hacktoberfest.com/">Hacktoberfest</a> is a yearly event in October sponsored by DigitalOcean to support open source. </p>
<p>To participate in this event and get your pull requests reviewed and counted, you should check whether a project is involved in Hacktoberfest before contributing.</p>
<p>A project participating in the event should have a <code>hacktoberfest</code> topic that you can find tagged in the "About" section of the repository's main page.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/about-repository-github.png" alt="Image" width="600" height="400" loading="lazy">
<em>The "About" section on the right sidebar of a repository with <code>hacktoberfest</code> as one of the topics — Credit: <a target="_blank" href="https://github.com/AliceWonderland/hacktoberfest">AliceWonderland/hacktoberfest</a></em></p>
<h2 id="heading-how-to-fork-a-repository">How to Fork a Repository</h2>
<p>So, you're ready to contribute to a repository of your choice. The first thing that you should do is to fork the repository.</p>
<p>Fork means creating a copy of a repository in your GitHub account.</p>
<p>You always want to fork a repository because most open-source project owners don't authorize contributors to push changes directly to their repositories.</p>
<p>By convention, your forked repository is called the <code>origin</code> repository, while the original repository is the <code>upstream</code> repository. I will use these aliases from now on to differentiate them.</p>
<p>At the repository's main page on GitHub, click the <code>Fork</code> button at the top right:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/fork-button.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>Fork</code> button on GitHub</em></p>
<p>It will redirect you to the "Create a new fork" form. You can leave the inputs as it is. Then, click the green "Create fork" button at the bottom.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/create-new-fork.png" alt="Image" width="600" height="400" loading="lazy">
<em>A <code>Create a new fork</code> form with a green <code>Create fork</code> button on GitHub</em></p>
<p>This will create a copy of the repository in your GitHub account.</p>
<h2 id="heading-how-to-clone-a-repository">How to Clone a Repository</h2>
<p>After forking the repository, the next thing to do is to clone it.</p>
<p>Cloning a repo means creating a copy of a repository in your local environment. You should clone your forked repository when contributing to an open-source project.</p>
<p>Here are the steps to follow:</p>
<h4 id="heading-step-1-navigate-to-the-forked-repo">Step #1 - Navigate to the forked repo</h4>
<p>Navigate to your forked repository with these steps:</p>
<ul>
<li>Click your avatar on the top right.</li>
<li>Click <code>Your repositories</code> on the dropdown menu.</li>
<li>Click the repository that you want to clone to open it.</li>
</ul>
<p>Then click on the green <code>&lt;&gt; Code</code> button. Copy the HTTPS URL by clicking the copy icon.</p>
<p>To ensure that you are cloning the forked repository, you should see your GitHub username in the link. For example:</p>
<pre><code class="lang-text">https://github.com/&lt;github-username&gt;/&lt;repository-name&gt;.git
</code></pre>
<p>That is:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/avatar-github.png" alt="Image" width="600" height="400" loading="lazy">
<em>User's avatar on GitHub</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/dropdown-github-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>Dropdown menu on GitHub that highlights <code>Your repositories</code></em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/clone-github-resize-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>A green <code>&amp;lt;&amp;gt; Code</code> button and a HTTPS URL of a repository followed by a copy icon on GitHub</em></p>
<h4 id="heading-step-2-clone-the-project-locally">Step #2 - Clone the Project Locally</h4>
<p>In your terminal, run the <code>git clone</code> command along with the URL that you copied:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> &lt;copied-url&gt;
</code></pre>
<p>You can navigate to the project's directory with this command:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> &lt;project-name&gt;
</code></pre>
<h2 id="heading-how-to-create-a-new-branch">How to Create a New Branch</h2>
<p>The best practice in open source is to create a new branch whenever you are going to work on an issue. A new branch isolates your changes and keeps the <code>main</code> branch clean.</p>
<p>Run this command to create a new branch and navigate to it:</p>
<pre><code class="lang-bash">git checkout -b &lt;branch-name&gt;
</code></pre>
<p>Although you can give a branch any name, you should follow conventions related to naming a branch. A branch name usually refers to the change that you make. For example, <code>feature/add-dark-mode</code> or <code>bugfix/broken-link-to-about-page</code>.</p>
<p>Now you can start to make changes in your new branch.</p>
<h2 id="heading-how-to-add-changes-to-the-staging-area">How to Add Changes to the Staging Area</h2>
<p>Let's say you've finished working on changes. Before committing, you must first add them to the staging area.</p>
<p>This step allows you to keep your changes while you can still modify them before committing. It also lets you choose which change(s) you're ready to commit.</p>
<p>Adding changes to the staging area is often seen as a less critical step. But that's not true. This step allows you to change your mind before committing. Because once you commit your changes, you add a piece of story to the project's history.</p>
<h3 id="heading-how-to-add-single-or-multiple-files-to-the-staging-area">How to Add Single or Multiple Files to the Staging Area</h3>
<p>When you want to add one or multiple files — but not all — to the staging area, run this command:</p>
<pre><code class="lang-bash">git add &lt;file-name-1&gt; &lt;file-name-2&gt;
</code></pre>
<p>For example:</p>
<pre><code class="lang-bash">git add README.md CONTRIBUTING.md
</code></pre>
<p>The command above adds the <strong>README.md</strong> and <strong>CONTRIBUTING.md</strong> files to the staging area.</p>
<p>When you add nested files(s) to the staging area, you want to add the path(s) to the file(s). If you can't figure out the exact path, running <code>git status</code> will help give you the status of the files that contain your changes.</p>
<p>Here is how to do it:</p>
<p>Run <code>git status</code> in your terminal. You will see something like this:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/git-status-modified-files-4.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>git status</code> showing paths to three modified files on the VSCode terminal</em></p>
<p>Copy the path and run the <code>git add</code> command along with the path(s) to the file(s):</p>
<pre><code class="lang-bash">git add &lt;path-to-file-1&gt; &lt;path-to-file-2&gt;
</code></pre>
<p>Here is an example of adding paths to two files based on the screenshot above:</p>
<pre><code class="lang-bash">git add app/routes/__frontend/resources/index.mdx app/routes/__frontend/resources/developer-resources/open-source/index.mdx
</code></pre>
<h3 id="heading-how-to-add-all-files">How to Add All Files</h3>
<p>When you want to add all files to the staging area, run this command:</p>
<pre><code class="lang-bash">git add .
</code></pre>
<p>This adds all the files with changes to the staging area.</p>
<h2 id="heading-how-to-commit-changes">How to Commit Changes</h2>
<p>To commit means to record your changes. That is why a commit requires a message as the record. Over time, commits will tell the story of the project's history. So, a clear and descriptive commit message is essential.</p>
<p>What you should know when committing your changes:</p>
<ul>
<li><strong>Add and commit your changes often</strong>. The best time to add and commit your changes is every time you finish making a meaningful change, even if it's a small change. Committing your work once completed also prevents your changes from being carried over to other branches.</li>
<li><strong>Use a clear and descriptive message</strong>. "Change the background color from black to dark blue" is more descriptive and easy to understand by everyone than "Fix style".</li>
</ul>
<p>To make a commit, run this command in your terminal:</p>
<pre><code class="lang-bash">git commit -m <span class="hljs-string">"Your message"</span>
</code></pre>
<p>Here is an example of a single line commit:</p>
<pre><code class="lang-bash">git commit -m <span class="hljs-string">"Fix the link to the About page"</span>
</code></pre>
<p>And here's a commit with multiple lines:</p>
<pre><code class="lang-bash">git commit -m <span class="hljs-string">"Fix the link to the About page
Fix the typos in the About page"</span>
</code></pre>
<h2 id="heading-how-to-synchronize-changes">How to Synchronize Changes</h2>
<p>When you are working on changes, there is a possibility that the <code>main</code> branch on the <code>upstream</code> repository has already merged in some pull requests. So, the state of the <code>origin</code> and your local repositories at this time will no longer be the same as the <code>upstream</code>.</p>
<p>For this reason, you should always update your local working branch so you'll push the same state as the <code>upstream</code> repository.</p>
<h3 id="heading-how-to-update-the-origin-repository">How to Update the <code>origin</code> Repository</h3>
<p>First, go to the <code>origin</code> repository on GitHub to check if it's up to date with the <code>upstream</code>.</p>
<p>You can push your changes when no change exists in the <code>upstream</code> repository.</p>
<p>To know if the <code>origin</code> repository is up to date, you'll see a message that says, "This branch is up to date with " on the main page of the repository, as shown in the screenshot below:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/up-to-date-branch-github-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>An up-to-date branch in the <code>origin</code> repository on GitHub</em></p>
<p>But when there are changes, you will see a message that says, "This branch is X commit(s) behind ".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/branch-x-commits-behind-github-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>A message indicating a branch in the <code>origin</code> repository is eight commits behind the <code>upstream</code> repository on GitHub</em></p>
<p>To update the <code>origin</code> repository:</p>
<ol>
<li>Click the <code>Sync fork</code> dropdown button.</li>
<li>Click the green <code>Update branch</code> button.</li>
</ol>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/update-branch.png" alt="Image" width="600" height="400" loading="lazy">
<em>The <code>Sync fork</code> and <code>Update branch</code> buttons on GitHub</em></p>
<p>After it's updated, you will see a "Successfully fetched and fast-forwarded from upstream " notification at the top.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/successfully-fetched-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>A notification "Successfully fetched and fast-forwarded from upstream" on GitHub</em></p>
<h3 id="heading-how-to-pull-changes">How to Pull Changes</h3>
<p>Now that your <code>origin</code> is up to date with the <code>upstream</code> repository, it's time to pull the changes and update your local one.</p>
<p>Pull is a way of getting new changes from the remote to the local repository.</p>
<p>To pull the changes, ensure that you are on your working branch. You can do so by running <code>git status</code>:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/git-status-branch.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>git status</code> showing a branch name</em></p>
<p>Run the <code>git pull</code> command to pull the changes from the <code>main</code> branch in the <code>origin</code> repository:</p>
<pre><code class="lang-bash">git pull origin main
</code></pre>
<p>You can now push your changes if you don't need to resolve conflicts.</p>
<h2 id="heading-how-to-resolve-merge-conflicts">How to Resolve Merge Conflicts</h2>
<p>After updating your local repository, you might encounter conflicts that you must fix before you can push your changes.</p>
<p>It's common to encounter these conflicts in open source projects. Merge conflicts usually occur when there are changes in the same line(s) and file(s) from two different branches.</p>
<p>When a conflict arises, you will see options for accepting changes on top of your workspace in VSCode. You will also see another change(s) different from yours — the incoming change.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/git-conflict.png" alt="Image" width="600" height="400" loading="lazy">
<em>Options to accept change, the current change, and the incoming change on VSCode</em></p>
<h3 id="heading-how-to-fix-merge-conflicts">How to Fix Merge Conflicts</h3>
<p>You can choose from different options when you want to resolve a conflict:</p>
<ul>
<li><strong>Accept Current Change</strong>: When you wish to keep your changes only.</li>
<li><strong>Accept Incoming Change</strong>: When you want to accept only the incoming changes that aren't yours.</li>
<li><strong>Accept Both Changes</strong>: When you want to accept your changes and the incoming changes.</li>
</ul>
<p>You can still fix things if necessary after choosing the desirable action.</p>
<p>After resolving the conflicts, you can then add your changes to the staging area and commit them.</p>
<p>Since you'll add and commit changes in an existing file, you can run this command to do both actions at the same time:</p>
<pre><code class="lang-bash">git commit -am <span class="hljs-string">"Your message"</span>
</code></pre>
<h2 id="heading-how-to-push-changes">How to Push Changes</h2>
<p>Now, it's time to push your changes. This means moving changes from the local to the remote repository.</p>
<p>You always want to push your changes to the <code>origin</code> repository. To do that, run this command in your terminal:</p>
<pre><code class="lang-bash">git push origin &lt;branch-name&gt;
</code></pre>
<p>There's a possibility that you may get this error message:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/no-upstream-branch-1.png" alt="Image" width="600" height="400" loading="lazy">
<em><code>git push</code> message "fatal: The current branch &lt;branch-name&gt; has no upstream branch."</em></p>
<p>You can copy, paste, and run the command in the error message in your terminal:</p>
<pre><code class="lang-bash">git push --set-upstream origin &lt;branch-name&gt;
</code></pre>
<p> Alternatively, you can run this command:</p>
<pre><code class="lang-bash">git push -u origin &lt;branch-name&gt;
</code></pre>
<h2 id="heading-how-to-create-pull-request">How to Create Pull Request</h2>
<p>A pull request — commonly called a PR — is a way to notify others that a branch with changes has been pushed to a remote repository.</p>
<p>After a pull request is opened, maintainers can review and discuss your changes. They can ask you to make more changes before they can merge your pull request or merge them immediately into the <code>main</code> branch.</p>
<h3 id="heading-how-to-create-a-pull-request">How to Create a Pull Request</h3>
<p>First, go to the <code>upstream</code> or <code>origin</code> repository on GitHub. </p>
<p>Then click the green <code>Compare &amp; pull request</code> button to redirect to the <code>Open a pull request</code> form:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/compare-and-pull-request1.png" alt="Image" width="600" height="400" loading="lazy">
<em>The green <code>Compare &amp;amp; pull request</code> button on GitHub</em></p>
<p>Then fill out the pull request form. If there's a pull request template, complete all required areas to help maintainers review your changes.</p>
<p>If there is no pull request template, you can write the pull request in a structured manner. Consider this when writing your pull request:</p>
<ul>
<li>A short, clear, and informative title.</li>
<li>A clear description of the changes.</li>
<li>The link to the related issue. For example, "Closes #456".</li>
<li>Screenshots or screen recordings when necessary.</li>
</ul>
<p>Lastly, click the green <code>Create pull request</code> button at the bottom to create a PR.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/create-pull-request-button.png" alt="Image" width="600" height="400" loading="lazy">
<em>The green <code>Create pull request</code> on GitHub</em></p>
<h2 id="heading-final-words">Final Words</h2>
<p>Contributing to open-source projects can be daunting and make you feel intimidated at the beginning. But like other skills, with continuous practice, you will become better.</p>
<p>Besides understanding Git and GitHub, there are <a target="_blank" href="https://www.freecodecamp.org/news/how-to-contribute-to-open-source/">non-technical aspects of open source that you should know</a> too.</p>
<p>And once you get the grip, open source can be so much fun!</p>
<p>If you liked and enjoyed this article, please share it with others. You can find other works of mine on my <a target="_blank" href="https://adiati.com/">blog</a>, and let's connect on <a target="_blank" href="https://twitter.com/@AdiatiAyu">X (formerly Twitter)</a> or <a target="_blank" href="https://www.linkedin.com/in/adiatiayu/">LinkedIn</a>!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Contribute to Open Source Projects – Non-Technical Things You Should Know ]]>
                </title>
                <description>
                    <![CDATA[ I've contributed to open-source projects for a few years and learned a lot from the process. These experiences allowed me to look closer at the open source flow, from the technical, such as Git and GitHub, to the non-technical aspects. Although they ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-contribute-to-open-source/</link>
                <guid isPermaLink="false">66ba11e31a6c5fb4d0a38b3e</guid>
                
                    <category>
                        <![CDATA[ beginners guide ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GitHub ]]>
                    </category>
                
                    <category>
                        <![CDATA[ open source ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ayu Adiati ]]>
                </dc:creator>
                <pubDate>Thu, 14 Sep 2023 17:34:52 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2023/09/How-to-Contribute-to-Open-Source-Projects-Non-Technical-Things-You-Should-Know--1-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>I've contributed to open-source projects for a few years and learned a lot from the process. These experiences allowed me to look closer at the open source flow, from the technical, such as Git and GitHub, to the non-technical aspects.</p>
<p>Although they are as important as the technical sides, the non-technical ones often get overlooked. In this article, I will share the essential non-technical things you should know when contributing to open source projects. </p>
<h2 id="heading-what-are-the-important-files-in-a-repository">What are the Important Files in a Repository?</h2>
<p>In this section, we'll talk about some of the important files you'll likely come across when contributing to an open source project.</p>
<h3 id="heading-the-readmemd-file">The <code>README.md</code> File</h3>
<p>When you're interested in contributing to an open-source project, you should always read the <code>README.md</code> file — commonly called README — to familiarize yourself with the project.</p>
<p>The <code>README.md</code> file is the face of the project, containing everything essential. You'll usually find most, if not all, of these sections in a README:</p>
<ul>
<li>The project's description.</li>
<li>The technology used for the project.</li>
<li>Instructions on how to install, run, and use the project.</li>
<li>The project's license.</li>
<li>The code of conduct.</li>
<li>How to contribute to the project.</li>
<li>The expected communication style (through issue and pull request comments, GitHub discussion, chat service apps such as Slack or Discord, and so on).</li>
</ul>
<h3 id="heading-the-contributingmd-file"><strong>The</strong> <code>CONTRIBUTING.md</code> File</h3>
<p>Next, you must know the rules to follow in order to contribute to a project. The procedures and requirements for contributing may differ between projects. For example, in some projects, you're required to comment on an issue before it gets assigned to you, while others allow you to assign an issue to yourself.</p>
<p>The <code>CONTRIBUTING.md</code> file serves as a contribution guide. It explains the community's rules and expectations from their contributors, from creating an issue to creating a pull request.</p>
<p>In most cases, you'll find a contribution section in the README. But if it's not included in the README, you can find it in a file named <code>CONTRIBUTING.md</code> or anything similar.</p>
<h3 id="heading-the-license-file">The <code>LICENSE</code> File</h3>
<p>You can't just assume that all projects on GitHub are open-source and that their codebase is freely available.</p>
<blockquote>
<p>"In most jurisdictions, any code or content is automatically copyrighted by the author, with all rights reserved, unless otherwise stated." (Source: <a target="_blank" href="https://arstechnica.com/gadgets/2020/02/how-to-choose-an-open-source-license/">Open source licenses: What, which, and why</a>)</p>
</blockquote>
<p>"All rights reserved" means that no one may use, modify, or redistribute anything in the project unless the owner gives you permission to. If you ignore it, they can legally sue you. So, a project on GitHub is only open source if they have a license that specifies that.</p>
<p>You'd usually find a license section on the README, in the "About" section of a repository. It is found in a file called <code>LICENSE</code>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/repo-about-section-github-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>An MIT license in the "About" section on the right sidebar of a repository on GitHub</em></p>
<h3 id="heading-the-codeofconductmd-file">The <code>CODE_OF_CONDUCT.md</code> File</h3>
<p>You should habitually read the community's Code of Conduct (COC). The COC is the house rule of the community. It is there for a reason: to maintain a safe, welcoming space for contributors. Following the COC will prevent you from getting banned from the community and the project.</p>
<p>You can find the COC in a file called <code>CODE_OF_CONDUCT.md</code>, in the "About" section on of the repository. Most times, it's also included in the README and contributing guide.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/code-of-conduct-on-github.png" alt="Image" width="600" height="400" loading="lazy">
<em>Code of Conduct in the "About" section on the right sidebar of a repository on GitHub</em></p>
<h2 id="heading-ethics-in-open-source"><strong>Ethics in Open Source</strong></h2>
<h3 id="heading-check-for-duplication">Check for Duplication</h3>
<p>Let's say you install and run a project on your local machine and encounter a bug. Or you read through the docs and find a missing step. You might want to raise an issue to address it.</p>
<p>Before doing so, you must check if a similar (open and closed) issue or pull request has been raised to avoid duplication. Enter possible keywords in the search bar on top of the issue or pull request page on GitHub to check for possible duplication.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/search-bar-github.png" alt="Image" width="600" height="400" loading="lazy">
<em>Search bar on top of the issue or pull request page on GitHub</em></p>
<p>For example:</p>
<pre><code class="lang-text">is:issue is:open docs
</code></pre>
<pre><code class="lang-text">is:pull request is:closed button
</code></pre>
<p>Checking for duplicates will help prevent your issue or pull request from getting turned down by maintainers.</p>
<h3 id="heading-ask-for-permission-before-working-on-an-issue">Ask for Permission before Working on an Issue</h3>
<p>One of the essential ethics in open source is asking for the maintainer's permission to work on an issue unless stated otherwise in the contribution guide. Asking for permission helps the maintainers in controlling and avoiding duplicate pull requests.</p>
<p>You only want to work on changes and create a pull request after you get the green light from a maintainer. If you ignore this part and go ahead to work on the changes, your pull request will likely be ignored or turned down. This is because the issue may have been assigned to someone else already, or the issue may not be their priority at that moment. </p>
<p>Either way, it would be a loss for you. So, what should you do when asking for permission?</p>
<h4 id="heading-1-check-if-the-issue-has-already-been-assigned">1. Check if the issue has already been assigned</h4>
<p>You can see if an issue has been assigned by looking at the "Assignee" column when you open the issue tab in the GitHub repository or on the right sidebar when you open the issue.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/issue-tab-github-01-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Assignee column on the issues page on GitHub</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/issue-right-sidebar-01-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>Assignees section on the right sidebar of the issue page on GitHub</em></p>
<h4 id="heading-2-check-the-comment-threads">2. Check the comment threads</h4>
<p>You also want to make sure that someone has not already asked the maintainers to assign the issue to them. If they haven't gotten any response, then the maintainers have probably not seen the comment. You should also check other information in the threads to understand more about the issue.</p>
<h4 id="heading-3-leave-a-comment-to-request-for-an-issue-you-want-to-work-on">3. Leave a comment to request for an issue you want to work on</h4>
<p>You can say, "Hi, I want to work on this issue. Can you assign it to me?" Or, "I see this issue has been assigned, but I haven't seen any activity here in a while. If you still need help, can I work on this?"</p>
<h4 id="heading-4-wait-until-the-maintainer-replies-to-your-message">4. Wait until the maintainer replies to your message</h4>
<p>If they (the maintainer(s)) say you can have it and assign it to you, then you can start working on the issue and, in the end, create a pull request.</p>
<h3 id="heading-what-is-the-good-first-issue-label">What is the Good First Issue Label?</h3>
<p>Labels on GitHub are tags that pass information about the type or the status of an issue or a pull request. A <code>good-first-issue</code> is a label considered appropriate for beginners by the project's owner and maintainers.</p>
<p>I once created an issue about a broken link. I explained the bug and the steps contributors must take to resolve it.</p>
<p>I also mentioned that this issue is beginner-friendly, so we want to leave it for beginners who wish to contribute to the project. After passing the review from the maintainers, the issue was labeled as a <code>good-first-issue</code>.</p>
<p>The sad part was that people who deliberately took the issue were not beginners.</p>
<p>If you already have some experience, please consider leaving this label. It is meant for beginners in open source or the technology used in the project.</p>
<h3 id="heading-good-communication-and-patience">Good Communication and Patience</h3>
<p>Always use clear and polite words to communicate with maintainers and other contributors. Remember that async communication is prone to loss in translation and miscommunication.</p>
<p>If you need more clarification on something, ask the maintainers. Don't make assumptions. You can ask questions in the issue or pull request comments. Some communities also have a GitHub discussions board that you can find on the top bar, while some use chat service apps like Slack or Discord to share ideas and ask questions or clarifications.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2023/09/discussion-tab-github.png" alt="Image" width="600" height="400" loading="lazy">
<em>Discussions tab on GitHub</em></p>
<p>A maintainer may ask you to fix something in your pull request or ask for clarifications using a straightforward sentence. Short and direct messages mostly happen because they are busy. They must be fast and effective in replying to messages. Don't take it personal as this may lead to poor communication or even lead to losing your chance at contributing.</p>
<p>Most of the maintainers and contributors in open source are volunteers. That said, they have life and other duties outside of the project. So, when you're contributing, you need to have patience. Don't ask maintainers to immediately answer your question or merge your pull request.</p>
<h3 id="heading-write-issue-and-pull-request-in-a-structured-way">Write Issue and Pull Request in a Structured Way</h3>
<p>Some open-source communities provide templates on GitHub for opening an issue or creating a pull request. But when they don't, consider writing them in a structured manner. It would be handy for everyone to see the details and help maintainers review and merge pull requests.</p>
<h4 id="heading-how-to-write-a-github-issue">How to Write a GitHub Issue</h4>
<p>Here are some things to consider when writing an issue:</p>
<p><strong>Use c</strong>lear and descriptive title<strong>s</strong>: By reading a clear and descriptive title, everyone can understand the issue. For example, "fix: Link to the About page leads to 404".</p>
<p><strong>Search</strong> for <strong>similar issues</strong>: Check open and closed issues to see if there is a similar or identical issue as yours. If you don't find any, then include in the description that you've checked and did not find any similar issues. This step is essential to avoid any duplication.</p>
<p><strong>Description of the issue</strong>: Describe the issue as straightforward as possible.</p>
<p><strong>Expected behavior</strong>: Describe the expected behavior of an issue.</p>
<p><strong>Actual behavior</strong>: State the actual problematic behavior that causes the issue.</p>
<p><strong>Reproduce the problem</strong>: What steps do we need to take to reproduce the problem? It would be helpful for everyone to run the same steps and test it out. Here's an example:</p>
<pre><code class="lang-markdown"><span class="hljs-bullet">1.</span> Go to this link.
<span class="hljs-bullet">2.</span> Click this button.
<span class="hljs-bullet">3.</span> This is what is happening.
</code></pre>
<p><strong>Screenshots or screen recording</strong>s: Provide some screenshots or screen recordings if necessary. It is usually beneficial for UI issues.</p>
<p><strong>Suggest a solution</strong>: If you have a solution in mind, you can give a suggestion. But if you don't, it's okay too. You are not expected to have a solution when you raise an issue.</p>
<p>Here's an examples that uses the points listed above:</p>
<pre><code class="lang-markdown"><span class="xml"><span class="hljs-comment">&lt;!-- Issue title --&gt;</span></span>
<span class="hljs-section"># fix: Link to the About page leads to 404</span>

<span class="xml"><span class="hljs-comment">&lt;!-- Issue body --&gt;</span></span>
<span class="hljs-section">## Description</span>

When I went to the About page, I got a 404.
I have searched and didn't find any similar issues.

<span class="hljs-section">## Expected Behavior</span>

We should see the About section when we go to the About page.

<span class="hljs-section">## Actual Behaviour</span>

When we go to the About page, we see a 404 page.

<span class="hljs-section">## How to Reproduce</span>

<span class="hljs-bullet">1.</span> Go to the https://website.com.
<span class="hljs-bullet">2.</span> Click the About tab.
<span class="hljs-bullet">3.</span> You will see the 404.

<span class="hljs-section">## Screenshots</span>

![<span class="hljs-string">404 in about page</span>](<span class="hljs-link">link to the image</span>)

<span class="hljs-section">## Suggestion</span>

Fix and use the correct link to the About page.
</code></pre>
<h4 id="heading-how-to-write-a-pull-request">How to Write a Pull Request</h4>
<p>Here are some things to consider when writing a pull request:</p>
<p><strong>Use a s</strong>hort, clear, and informative title<em>**</em>: For example, "fix: Link to About page".</p>
<p><strong>Use a </strong>clear description of the fix<em>**</em>: For example, "This pull request fixes the link to the About page that previously led to 404."</p>
<p><strong>Link to the</strong> related <strong>issue</strong>: Include the link to the related issue. For example, "Fixes #123".</p>
<p><strong>Screenshots or screen recording</strong>s: Provide some screenshots or screen recordings that shows the issue before and after the fix if necessary.</p>
<p>Here's an example that uses the structure above:</p>
<pre><code class="lang-markdown"><span class="xml"><span class="hljs-comment">&lt;!-- Pull request title --&gt;</span></span>
<span class="hljs-section"># fix: Link to About page</span>

<span class="xml"><span class="hljs-comment">&lt;!-- Pull request body --&gt;</span></span>
<span class="hljs-section">## Related Issue</span>

Fixes #123

<span class="hljs-section">## Description</span>

This PR fixes the link to the About page that previously led to 404.

<span class="hljs-section">## Screenshots</span>

<span class="hljs-section">### Before</span>

![<span class="hljs-string">404 in about page</span>](<span class="hljs-link">link to the image</span>)

<span class="hljs-section">### After</span>

![<span class="hljs-string">About page</span>](<span class="hljs-link">link to the image</span>)
</code></pre>
<h2 id="heading-good-to-know-contributing-to-open-source-is-not-all-about-code">Good to Know: Contributing to Open Source is Not All About Code</h2>
<p>I often hear that people — especially beginners — hesitate to contribute to open source because they need more skills or time to help with code. However, contributing to an open-source project is involves more than just code.</p>
<p>There are many non-technical ways to contribute to a project and its community, such as:</p>
<ul>
<li>Opening an issue when you see a bug or room for improvement.</li>
<li>Reviewing issues and pull requests.</li>
<li>Improving the project's documentation.</li>
<li>Answering questions.</li>
<li>Throwing ideas around the project.</li>
<li>Onboarding new contributors.</li>
<li>Mentoring other contributors.</li>
<li>Writing a blog post or creating a video about the project.</li>
<li>Promoting the project on social media, and many more!</li>
</ul>
<h2 id="heading-final-words">Final Words</h2>
<p>Contributing to open-source projects is not all about understanding Git and GitHub. Some non-technical things are important for you to know, too. I hope this article helps.😊</p>
<p>If you liked and enjoyed this article, please share it. You can find other works of mine on my <a target="_blank" href="https://adiati.com">blog</a>, and let's connect on <a target="_blank" href="https://twitter.com/@AdiatiAyu">X (formerly Twitter)</a> or <a target="_blank" href="https://www.linkedin.com/in/adiatiayu/">LinkedIn</a>!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
