<?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 & Github Blogs]]></title><description><![CDATA[Git & Github Blogs]]></description><link>https://git-and-github-blogs.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 01:34:21 GMT</lastBuildDate><atom:link href="https://git-and-github-blogs.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Git and GitHub Basics]]></title><description><![CDATA[Week 4: Git and GitHub Challenge - Solution
Task 1: Fork and Clone the Repository
Commands Used:
# Clone the forked repository
git clone https://github.com/<your-username>/90DaysOfDevOps.git

# Navigate into the cloned repository
cd 90DaysOfDevOps/20...]]></description><link>https://git-and-github-blogs.hashnode.dev/git-and-github-basics</link><guid isPermaLink="true">https://git-and-github-blogs.hashnode.dev/git-and-github-basics</guid><category><![CDATA[#90daysofdevops]]></category><category><![CDATA[gitgithub]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[Vaishnavi Jadhav]]></dc:creator><pubDate>Wed, 19 Feb 2025 04:32:20 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-week-4-git-and-github-challenge-solution">Week 4: Git and GitHub Challenge - Solution</h1>
<h2 id="heading-task-1-fork-and-clone-the-repository">Task 1: Fork and Clone the Repository</h2>
<h3 id="heading-commands-used">Commands Used:</h3>
<pre><code class="lang-plaintext"># Clone the forked repository
git clone https://github.com/&lt;your-username&gt;/90DaysOfDevOps.git

# Navigate into the cloned repository
cd 90DaysOfDevOps/2025/git/01_Git_and_Github_Basics
</code></pre>
<h2 id="heading-task-2-initialize-a-local-repository-and-create-a-file">Task 2: Initialize a Local Repository and Create a File</h2>
<h3 id="heading-commands-used-1">Commands Used:</h3>
<pre><code class="lang-plaintext"># Create a new directory for the challenge
mkdir week-4-challenge
cd week-4-challenge

# Initialize a new Git repository
git init

# Create a file and add content
vim info.txt

# Stage the file for commit
git add info.txt

# Commit the changes
git commit -m "Initial commit: Add info.txt with introductory content"
</code></pre>
<h2 id="heading-task-3-configure-remote-url-with-pat-and-pushpull">Task 3: Configure Remote URL with PAT and Push/Pull</h2>
<h3 id="heading-commands-used-2">Commands Used:</h3>
<pre><code class="lang-plaintext"># Configure remote URL with PAT
git remote add origin https://&lt;your-username&gt;:&lt;your-PAT&gt;@github.com/&lt;your-username&gt;/90DaysOfDevOps.git

#If a remote named origin already exists, update it with:
git remote set-url origin https://&lt;your-username&gt;:&lt;your-PAT&gt;@github.com/&lt;your-username&gt;/90DaysOfDevOps.git

# Push the changes to GitHub
git push -u origin master

# Pull latest changes from remote repository (optional)
git pull origin master
</code></pre>
<h2 id="heading-task-4-explore-your-commit-history">Task 4: Explore Your Commit History</h2>
<h3 id="heading-commands-used-3">Commands Used:</h3>
<pre><code class="lang-plaintext"># View commit history
git log
</code></pre>
<h2 id="heading-task-5-advanced-branching-and-switching">Task 5: Advanced Branching and Switching</h2>
<h3 id="heading-commands-used-4">Commands Used:</h3>
<pre><code class="lang-plaintext"># Create a new branch
git checkout -b feature-update  
# OR 
git branch feature-update

# Switch to the new branch
git switch feature-update
# OR
git checkout feature-update

# Modify the file
vim info.txt

# Stage and commit changes
git add info.txt
git commit -m "Feature update: Enhance info.txt with additional details"

# Push the branch to remote
git push origin feature-update
</code></pre>
<p>After pushing, create a <strong>Pull Request (PR)</strong> on GitHub to merge <code>feature-update</code> into <code>main</code>.</p>
<h2 id="heading-task-6-explain-branching-strategies">Task 6: Explain Branching Strategies</h2>
<h3 id="heading-why-are-branching-strategies-important">Why Are Branching Strategies Important?</h3>
<p>Branching strategies are essential in <strong>collaborative software development</strong> as they help manage code changes efficiently and minimize conflicts. Below are key reasons why they matter:</p>
<h3 id="heading-1-isolating-features-and-bug-fixes">1. <strong>Isolating Features and Bug Fixes</strong></h3>
<ul>
<li><p>Developers can work on new features or bug fixes in separate branches without disrupting the <code>main</code> branch.</p>
</li>
<li><p>This keeps the production-ready code stable while new updates are developed and tested.</p>
</li>
</ul>
<h3 id="heading-2-facilitating-parallel-development">2. <strong>Facilitating Parallel Development</strong></h3>
<ul>
<li><p>Multiple developers or teams can work on different features simultaneously.</p>
</li>
<li><p>Each developer has their own working branch, preventing conflicts until their changes are merged.</p>
</li>
</ul>
<h3 id="heading-3-reducing-merge-conflicts">3. <strong>Reducing Merge Conflicts</strong></h3>
<ul>
<li><p>By keeping changes organized in branches, the risk of merge conflicts is reduced.</p>
</li>
<li><p>Frequent integration using structured workflows ensures conflicts are resolved early.</p>
</li>
</ul>
<h3 id="heading-4-enabling-effective-code-reviews">4. <strong>Enabling Effective Code Reviews</strong></h3>
<ul>
<li><p>Code changes are reviewed in <strong>Pull Requests (PRs)</strong> before merging into the <code>main</code> branch.</p>
</li>
<li><p>This improves code quality and ensures best practices are followed.</p>
</li>
</ul>
<h3 id="heading-common-branching-strategies">Common Branching Strategies</h3>
<h4 id="heading-1-feature-branching">1️⃣ <strong>Feature Branching</strong></h4>
<ul>
<li><p>Each new feature gets its own branch (<code>feature-branch</code>).</p>
</li>
<li><p>Developers work independently and merge into <code>main</code> or <code>develop</code> once completed.</p>
</li>
</ul>
<h4 id="heading-2-git-flow">2️⃣ <strong>Git Flow</strong></h4>
<ul>
<li><p>Uses multiple branches:</p>
<ul>
<li><p><code>main</code> (stable production code)</p>
</li>
<li><p><code>develop</code> (active development)</p>
</li>
<li><p><code>feature</code> (new features)</p>
</li>
<li><p><code>release</code> (preparing a release)</p>
</li>
<li><p><code>hotfix</code> (urgent fixes)</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-3-github-flow">3️⃣ <strong>GitHub Flow</strong></h4>
<ul>
<li><p>A simpler approach:</p>
<ul>
<li><p>Work on a <strong>feature branch</strong>.</p>
</li>
<li><p>Open a <strong>Pull Request</strong>.</p>
</li>
<li><p>Get it reviewed and merged into <code>main</code>.</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-4-trunk-based-development">4️⃣ <strong>Trunk-Based Development</strong></h4>
<ul>
<li><p>Developers merge small, frequent changes directly into <code>main</code> without long-lived branches.</p>
</li>
<li><p>Reduces complexity and speeds up releases.</p>
</li>
</ul>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Branching strategies <strong>enhance teamwork, prevent disruptions, and improve code quality</strong>. Choosing the right strategy depends on project size, team workflow, and release cycle.</p>
]]></content:encoded></item></channel></rss>