<spanclass="line"><span>upstream https://github.com/qmk/qmk_firmware.git (push)</span></span></code></pre></div><p>Now that this is done, you can check for updates to the repo by running <code>git fetch upstream</code>. This retrieves the branches and tags — collectively referred to as "refs" — from the QMK repo, which now has the nickname <code>upstream</code>. We can now compare the data on our fork <code>origin</code> to that held by QMK.</p><p>To update your fork's master, run the following, hitting the Enter key after each line:</p><divclass="language- vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang"></span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><span>git checkout master</span></span>
<spanclass="line"><span>git push origin master</span></span></code></pre></div><p>This switches you to your <code>master</code> branch, retrieves the refs from the QMK repo, downloads the current QMK <code>master</code> branch to your computer, and then uploads it to your fork.</p><h2id="making-changes"tabindex="-1">Making Changes <aclass="header-anchor"href="#making-changes"aria-label="Permalink to "Making Changes {#making-changes}""></a></h2><p>To make changes, create a new branch by entering:</p><divclass="language- vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang"></span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><span>git checkout -b dev_branch</span></span>
<spanclass="line"><span>git push --set-upstream origin dev_branch</span></span></code></pre></div><p>This creates a new branch named <code>dev_branch</code>, checks it out, and then saves the new branch to your fork. The <code>--set-upstream</code> argument tells git to use your fork and the <code>dev_branch</code> branch every time you use <code>git push</code> or <code>git pull</code> from this branch. It only needs to be used on the first push; after that, you can safely use <code>git push</code> or <code>git pull</code>, without the rest of the arguments.</p><divclass="tip custom-block"><pclass="custom-block-title">TIP</p><p>With <code>git push</code>, you can use <code>-u</code> in place of <code>--set-upstream</code> — <code>-u</code> is an alias for <code>--set-upstream</code>.</p></div><p>You can name your branch nearly anything you want, though it is recommended to name it something related to the changes you are going to make.</p><p>By default <code>git checkout -b</code> will base your new branch on the branch that is currently checked out. You can base your new branch on an existing branch that is not checked out by adding the name of the existing branch to the command:</p><divclass="language- vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang"></span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><span>git checkout -b dev_branch master</span></span></code></pre></div><p>Now that you have a development branch, open your text editor and make whatever changes you need to make. It is recommended to make many small commits to your branch; that way, any change that causes issues can be more easily traced and undone if needed. To make your changes, edit and save any files that need to be updated, add them to Git's <em>staging area</em>, and then commit them to your branch:</p><divclass="language- vp-adaptive-theme"><buttontitle="Copy Code"class="copy"></button><spanclass="lang"></span><preclass="shiki shiki-themes github-light github-dark vp-code"><code><spanclass="line"><span>git add path/to/updated_file</span></span>
<spanclass="line"><span>git commit -m "My commit message."</span></span></code></pre></div><p><code>git add</code> adds files that have been changed to Git's <em>staging area</em>, which is Git's "loading zone." This contains the changes that are going to be <em>committed</em> by <code>git commit</code>, which saves the changes to the repo. Use descriptive commit messages so you can know what was changed at a glance.</p><divclass="tip custom-block"><pclass="custom-block-title">TIP</p><p>If you've changed multiple files, you can use <code>git add -- path/to/file1 path/to/file2 ...</code> to add all your desired files.</p></div><h2id="publishing-your-changes"tabindex="-1">Publishing Your Changes <aclass="header-anchor"href="#publishing-your-changes"aria-label="Permalink to "Publishing Your Changes""></a></h2><p>The last step is to push your changes to your fork. To do this, enter <code>git push</code>. Git will then publish the current state of <code>dev_branch</code> to your fork.</p></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-09de1c0f><!--[--><!--]--><divclass="edit-info"data-v-09de1c0f><divclass="edit-link"data-v-09de1c0f><aclass="VPLink link vp-external-link-icon no-icon edit-link-button"href="https://github.com/qmk/qmk_firmware/edit/master/docs/newbs_git_using_your_master_branch.md"target="_blank"rel="noreferrer"data-v-09de1c0f><!--[--><spanclass="vpi-square-pen edit-link-icon"data-v-09de1c0f></span> Edit this page<!--]--></a></div><!----></div><navclass="prev-next"data-v-09de1c0f><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link prev"href="/newbs_git_best_practices"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Previous page</span><spanclass="title"data-v-09de1c0f>Introduction</span><!--]--></a></div><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link next"href="/newbs_git_resolving_merge_conflicts"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Next page</span><spanclass="title"data-v-09de1c0f>Merge Conflicts</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>