<?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" version="2.0"><channel><title><![CDATA[git command]]></title><description><![CDATA[git command]]></description><link>https://gitcommand.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 14:06:37 GMT</lastBuildDate><atom:link href="https://gitcommand.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[To push your local codebase to GitHub, follow these steps with the complete set of Git commands:]]></title><description><![CDATA[Full Command Sequence:

Initialize the Git Repository (if not already done):
 git init


Add Remote Repository URL: Replace <repository-url> with your GitHub repository link (e.g., https://github.com/username/repository.git).
 git remote add origin <...]]></description><link>https://gitcommand.hashnode.dev/to-push-your-local-codebase-to-github-follow-these-steps-with-the-complete-set-of-git-commands</link><guid isPermaLink="true">https://gitcommand.hashnode.dev/to-push-your-local-codebase-to-github-follow-these-steps-with-the-complete-set-of-git-commands</guid><category><![CDATA[Git]]></category><category><![CDATA[GitHub]]></category><dc:creator><![CDATA[Deepak Kushwaha]]></dc:creator><pubDate>Sun, 26 Jan 2025 16:12:49 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-full-command-sequence">Full Command Sequence:</h3>
<ol>
<li><p><strong>Initialize the Git Repository (if not already done):</strong></p>
<pre><code class="lang-bash"> git init
</code></pre>
</li>
<li><p><strong>Add Remote Repository URL:</strong><br /> Replace <code>&lt;repository-url&gt;</code> with your GitHub repository link (e.g., <a target="_blank" href="https://github.com/username/repository.git"><code>https://github.com/username/repository.git</code></a>).</p>
<pre><code class="lang-bash"> git remote add origin &lt;repository-url&gt;
</code></pre>
</li>
<li><p><strong>Stage All Changes:</strong></p>
<pre><code class="lang-plaintext"> git add .
</code></pre>
</li>
<li><p><strong>Commit the Changes:</strong><br /> Replace <code>"Your commit message"</code> with a meaningful commit message.</p>
<pre><code class="lang-plaintext"> git commit -m "Your commit message"
</code></pre>
</li>
<li><p><strong>Push Code to GitHub:</strong><br /> Use the <code>-u</code> flag to set the upstream branch for easier future pushes.</p>
<pre><code class="lang-plaintext"> git push -u origin main
</code></pre>
</li>
</ol>
<h3 id="heading-switching-to-an-existing-branch">Switching to an Existing Branch:</h3>
<ol>
<li><p><strong>List all branches:</strong></p>
<pre><code class="lang-bash"> git branch
</code></pre>
<p> This will show all local branches. The current branch will have an asterisk (<code>*</code>) next to it.</p>
</li>
<li><p><strong>Switch to the desired branch:</strong></p>
<pre><code class="lang-bash"> git switch branch-name
</code></pre>
<p> Or, if you're using an older version of Git:</p>
<pre><code class="lang-bash"> git checkout branch-name
</code></pre>
</li>
</ol>
<hr />
<h3 id="heading-creating-and-switching-to-a-new-branch"><strong>Creating and Switching to a New Branch</strong></h3>
<ol>
<li><p><strong>Create and switch to a new branch in one step:</strong></p>
<pre><code class="lang-bash"> git switch -c new-branch-name
</code></pre>
<p> Or, with older Git versions:</p>
<pre><code class="lang-bash"> git checkout -b new-branch-name
</code></pre>
</li>
<li><p><strong>Push the new branch to the remote repository:</strong></p>
<pre><code class="lang-bash"> git push -u origin new-branch-name
</code></pre>
</li>
</ol>
<hr />
<h3 id="heading-switching-to-a-remote-branch"><strong>Switching to a Remote Branch</strong></h3>
<ol>
<li><p><strong>Fetch all branches from the remote:</strong></p>
<pre><code class="lang-bash"> git fetch
</code></pre>
</li>
<li><p><strong>Check out the remote branch:</strong></p>
<pre><code class="lang-bash"> git checkout branch-name
</code></pre>
<p> If you’re using Git 2.23 or newer, you can also use:</p>
<pre><code class="lang-bash"> git switch branch-name
</code></pre>
</li>
</ol>
<h3 id="heading-notes">Notes:</h3>
<ul>
<li><p>Replace <code>main</code> with <code>master</code> or the branch name you're using in your GitHub repository.</p>
</li>
<li><p>If your repository is private or requires authentication, GitHub will prompt for credentials (username and personal access token or SSH key).</p>
</li>
</ul>
]]></content:encoded></item></channel></rss>