<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dinesh Reddy on Medium]]></title>
        <description><![CDATA[Stories by Dinesh Reddy on Medium]]></description>
        <link>https://medium.com/@rmymdmz?source=rss-ec43d000b0f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Dinesh Reddy on Medium</title>
            <link>https://medium.com/@rmymdmz?source=rss-ec43d000b0f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:48:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rmymdmz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Continuing Our Git Journey: Advanced Commands]]></title>
            <link>https://medium.com/@rmymdmz/continuing-our-git-journey-advanced-commands-0e6281afce12?source=rss-ec43d000b0f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e6281afce12</guid>
            <category><![CDATA[git-config]]></category>
            <category><![CDATA[git-reset]]></category>
            <category><![CDATA[git-amend]]></category>
            <category><![CDATA[git-reset-hard]]></category>
            <category><![CDATA[git-reset-soft]]></category>
            <dc:creator><![CDATA[Dinesh Reddy]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 15:43:13 GMT</pubDate>
            <atom:updated>2026-01-22T15:43:13.111Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KyxAhQpFgG3_poifL7j70Q.png" /></figure><p>In the previous blog, we explored the basics of Git — understanding its three layers, learning how to install and initialize it, and practicing with git add, git commit, git status, and git log.</p><p>Now it’s time to level up. Git offers powerful commands that help you manage real-world scenarios: ignoring files, undoing mistakes, fine‑tuning commits, and even picking specific changes across branches. These tools give you more control and flexibility when working with your codebase.</p><p>In this post, we’ll cover:</p><ul><li>.gitignore → exclude files from tracking.</li><li>git reset (--soft, --hard, — mixed) → roll back commits in different ways.</li><li>git revert → safely undo a commit by creating a new one.</li><li>git config → customize Git settings.</li><li>git commit --amend → fix or update your last commit.</li></ul><p>By the end of this article, you’ll know how to handle mistakes, refine your commit history, and configure Git to work the way you want.</p><p>Before we dive into today’s topic I hope you have practiced yesterday’s commands.</p><blockquote>Note : — <strong>git reflog</strong> shows you the entire commit history including the deleted commits</blockquote><h3><strong>🙈 GIT IGNORE</strong></h3><p>Imagine you’re working on a project with multiple files in your working directory. Normally, you use git add to start tracking them. But in real‑world projects, not every file should be tracked. Think of log files, temporary build outputs, or even secret configuration files. If these end up in your repository, they can clutter history or expose sensitive data.</p><p>Even if you personally avoid adding them, there’s always a risk that someone else on the team might accidentally run git add and commit those files. To prevent this, Git provides a simple safeguard: the .gitignore file.</p><p>You create a file named .gitignore in your repository and list the filenames line by line inside it. Whenever you run git add, Git checks this list first. If a file is mentioned in .gitignore, Git will skip it — even if you try to add it manually. The only way to track it again is to remove its name from .gitignore.</p><p>Here’s how you set it up:</p><pre>touch .gitignore<br>vim .gitignore</pre><p>Inside the editor:</p><ul><li>Press i to go into insert mode.</li><li>Type the filenames you want Git to ignore, one per line. For example:</li></ul><pre>debug.log<br>secrets.env<br>temp/</pre><ul><li>Press Esc and then type :wq to save and quit.</li></ul><p>Now, when you run git add ., Git will automatically leave out debug.log, secrets.env, and the temp/ folder. Your repository stays clean, and you don’t have to worry about sensitive or unnecessary files sneaking in.</p><h3>👤GIT CONFIG</h3><p>Imagine you just installed Git and started committing files. By default, Git doesn’t know who you are, so it uses your computer’s name in the commit history. That’s not very helpful — when you look back, you want to see the actual developer’s name and email, not just “DESKTOP‑12345” or “User.”</p><p>Here’s what a commit might look like before configuration:</p><pre>Author: DESKTOP-12345 &lt;user@localhost&gt;<br>Date:   Thu Jan 22 18:31:00 2026 +0530<br><br>  Added file.java</pre><p>This doesn’t tell the team who actually made the change.</p><p>To fix this, Git lets you configure your identity with git config. Once you set it, Git remembers forever, and every commit will carry your name and email.</p><pre>git config --global user.name &quot;Reddy&quot;<br>git config --global user.email &quot;reddy@example.com&quot;</pre><p>Now, when you commit again, the history looks much clearer:</p><pre>Author: Reddy &lt;reddy@example.com&gt;<br>Date:   Thu Jan 22 18:35:00 2026 +0530<br><br>  Added file.java</pre><p>From this point onward, every commit will show your name and email, making collaboration transparent and professional.</p><h3><strong>↩️ GIT COMMIT AMEND</strong></h3><h3>Understanding git commit --amend</h3><p>Sometimes mistakes happen when committing. Maybe you typed the wrong commit message, or your Git identity wasn’t configured properly and the commit shows your computer name instead of your actual name. Don’t panic — Git gives you a way to fix the <strong>last commit</strong> without creating a new one.</p><p><strong>Scenario:</strong> You committed changes to file.java, but the commit history shows:</p><pre>Author: DESKTOP-12345 &lt;user@localhost&gt;<br>Date:   Thu Jan 22 18:40:00 2026 +0530<br><br>  Added file.java</pre><p>This doesn’t look professional — it should show your name and a meaningful message.</p><p>To fix this, you can amend the commit:</p><pre>git commit --amend --author=&quot;Reddy &lt;reddy@example.com&gt;&quot;</pre><p>Git will reopen the commit message editor, allowing you to correct the message. Once you save, the commit history updates:</p><pre>Author: Reddy &lt;reddy@example.com&gt;<br>Date:   Thu Jan 22 18:42:00 2026 +0530<br><br>  Added file.java with billing logic</pre><p>Now your commit reflects the right author and the corrected message.</p><h3>⬅️GIT RESET</h3><h3>Understanding git reset (Rollback)</h3><p>Think of git reset as a way to <strong>roll back</strong> to an earlier commit when something went wrong.</p><p><strong>Scenario:</strong> You made 5 commits to file.java.</p><ul><li>Commit 1 → added basic code</li><li>Commit 2 → added menu</li><li>Commit 3 → added billing logic</li><li>Commit 4 → fixed a bug</li><li>Commit 5 → added a new feature that turned out error‑prone</li></ul><p>Now you realize the 5th commit broke your code. You want to <strong>roll back to commit 4</strong>. That’s where git reset comes in. It lets you travel back linearly, commit by commit.</p><h3>Types of Reset</h3><blockquote><strong>1. Soft Reset</strong></blockquote><ul><li>Rolls back the commit but <strong>keeps your changes in the file</strong>.</li><li>It’s like saying: <em>“Undo the commit, but keep my work so I can fix it.”</em></li></ul><pre>git reset --soft &lt;commit_id&gt;</pre><blockquote><strong>2. Mixed Reset</strong> (default)</blockquote><ul><li>Rolls back the commit and <strong>unstages the changes</strong>, but the file still has your edits.</li><li>It’s like saying: <em>“Undo the commit and remove it from staging, but don’t delete my work.”</em></li></ul><pre>git reset &lt;commit_id&gt;</pre><blockquote><strong>3. Hard Reset</strong></blockquote><ul><li>Rolls back the commit and <strong>erases the changes from the file itself</strong>.</li><li>It’s like saying: <em>“Take me back to commit 4 exactly and throw away everything after it.”</em></li><li>You can also use git reset — — hard HEAD~1 (space after reset) to rollback one commit</li></ul><pre>git reset --hard &lt;commit_id&gt;</pre><h3>Beginner-Friendly Takeaway</h3><ul><li><em>Use </em><strong><em>soft</em></strong><em> when you want to fix the commit but keep your code.</em></li><li><em>Use </em><strong><em>mixed</em></strong><em> when you want to unstage changes but still keep them in your file.</em></li><li><em>Use </em><strong><em>hard</em></strong><em> when you want to completely erase the bad commit and its changes.</em></li></ul><h3><strong>↔️GIT REVERT</strong></h3><h3>Understanding git revert</h3><p>Sometimes you commit something that turns out to be wrong, but you don’t want to erase history. Maybe you’re working in a team, and deleting commits with reset could confuse others. In those cases, you need a safer way to undo changes while keeping the record intact. That’s exactly what git revert does.</p><p><strong>Scenario:</strong> You added a new feature in commit 5 that gave customers a “Free Coffee” promotion. Later, you realize this was a mistake — the business can’t afford it.</p><p>If you used git reset --hard, you’d roll back to commit 4 and erase commit 5 completely. But that means the history no longer shows that the “Free Coffee” idea ever existed. In collaborative projects, this can be risky because teammates lose track of what happened.</p><p>Instead, you run:</p><pre>git revert &lt;commit_id&gt;</pre><p>Git creates a <strong>new commit</strong> that cancels the changes introduced by commit 5. The history now looks like this:</p><ul><li>Commit 4 → fixed a bug</li><li>Commit 5 → added “Free Coffee” promotion</li><li>Commit 6 → reverted the promotion</li></ul><p>This way, everyone can see the mistake and the fix. Nothing is hidden, and the timeline stays intact.</p><h3>Practice Tasks</h3><p>To get comfortable with these commands, try the following in a test repository:</p><ul><li>Configure your Git identity with git config.</li><li>Make a commit, then fix its message using git commit --amend.</li><li>Create 5 commits on a file, then roll back to commit 4 using different types of git reset.</li><li>Undo a commit safely with git revert.</li><li>Add a .gitignore file and test ignoring logs or temp files.</li></ul><p>These small exercises will help you understand how Git handles mistakes, identity, and unnecessary files.</p><blockquote>What’s Next</blockquote><blockquote>In this post, we focused on commands that help you <strong>fix mistakes and keep your history clean</strong>. But Git’s real power shines when you start working with <strong>branches</strong> — parallel timelines of your project that let you experiment without breaking the main code.</blockquote><blockquote>In the next blog, we’ll explore <strong>branching, merging, and conflict resolution</strong>, and then move on to <strong>cherry-pick</strong> to see how you can bring specific changes across branches with precision.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e6281afce12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner’s Guide to Git with Scenarios]]></title>
            <link>https://medium.com/@rmymdmz/beginners-guide-to-git-with-scenarios-798fa37bb585?source=rss-ec43d000b0f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/798fa37bb585</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[git-github]]></category>
            <category><![CDATA[source-code-management]]></category>
            <category><![CDATA[version-control]]></category>
            <dc:creator><![CDATA[Dinesh Reddy]]></dc:creator>
            <pubDate>Mon, 19 Jan 2026 13:59:00 GMT</pubDate>
            <atom:updated>2026-01-19T13:59:00.790Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><h3>Are you new to Git or revisiting the basics? You’re in the right place.</h3><blockquote>Git is a version control system and source code manager. Some even expand Git humorously as Global Information Tracker.</blockquote><p>Before diving into GitHub you currently see people using, it’s important to first understand Git itself.</p><ul><li><strong>Imagine you’re building a project — say, a Coffee Shop website. You write code for your website, test it, and deploy it. Later, based on user feedback, you decide to add new features</strong></li></ul><p><strong>👉If you simply edit your existing files directly, you risk <em>breaking the working version.</em> If the new code fails, your whole application goes down. And if another developer is working with you, you’ll also want to know who made which changes, when, and why.</strong></p><p>For all this, we need Git. Git helps in tracking files, recording changes, and keeping every version safe. Your old code is Version 1, new code becomes Version 2, and Version 1 is always preserved.</p><p>Why Do We Need Git?</p><p>Let’s say you want to build a website for your coffee shop.</p><ul><li>You create your files, write the code, test it, and deploy it.</li><li>• Customers start using your website.</li><li>• Based on feedback, you decide to add new features.</li></ul><p>Now imagine: if you simply edit your existing files directly, what happens?</p><ul><li>If the new code has an error, the whole application fails.</li><li>• Your website goes down, and customers can’t use it.</li><li>• You lose track of what the previous version looked like.</li></ul><p>This is risky. You need a way to track changes, preserve old versions, and know who did what. That’s exactly where Git comes in.</p><blockquote>Git acts like a time machine for your code:</blockquote><ul><li>It saves every version safely.</li><li>• It lets you roll back if something breaks.</li><li>• It records who made each change and when.</li><li>• It allows multiple developers to work together without overwriting each other’s work.</li></ul><h3>How Git Works Inside</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*fGkp0s1lChScYaBf8mI54w@2x.jpeg" /></figure><p>Git operates with three layers that work together to track and save your code:</p><ol><li>Working Directory</li></ol><ul><li>This is where you actually create and edit files on your computer.</li><li>• Example: You write app.py with a simple print(“Hello World”).</li></ul><p>2. Staging Area (Index)</p><ul><li>The staging area is Git’s selection zone.</li><li>• When you run git add &lt;filename&gt;, Git moves the file into staging and starts tracking it.</li><li>• From this point, Git knows the file is being tracked. If you change it again, Git will detect the difference.</li><li>• To save those changes permanently, you commit them. Each commit creates a snapshot of the file that is stored in the repository forever.</li></ul><p>3. Repository (History)</p><ul><li>When you run git commit -m “message”, Git moves the staged snapshot into the repository.</li><li>• This becomes a permanent version in history.</li><li>• From here, you can always roll back or review this commit later.</li></ul><p>— -</p><h3>Installing and Initializing Git</h3><p>Before using Git, you need to install it on your system.</p><p>On Ubuntu Linux, you can install Git with:</p><p>sudo apt install git -y</p><pre>sudo apt install git-y</pre><p>Once installed, navigate to the folder where you want to start tracking your project:</p><pre>cd myfolder</pre><p>Now initialize Git in this folder:</p><pre>git init</pre><p>At this point, myfolder becomes your working directory. Git sets up the staging area and repository internally — you don’t have to worry about creating them manually.</p><p>— -</p><h3>Moving Files Through Git’s Layers</h3><p>Let’s try a simple example to understand how files move between Git’s layers.</p><ol><li>Create a file in your working directory</li></ol><pre>touch file.txt</pre><p>2. Add some content to it, for example print(“hello world!”)</p><pre>cat &gt; file.txt</pre><p><em>Write the data and press ctrl+D to exit editor</em></p><p>3. Stage the file so Git starts tracking it:</p><p>git add file</p><pre>git add file.txt</pre><p>➝ Now the file is in the staging area.</p><p>4. Commit the file to save this version permanently:</p><p>git commit -m “this is version1 of my data”</p><pre>git commit -m “my first commit” file.txt</pre><p>➝ The snapshot is stored in the repository. This version is preserved for life, and you can always roll back to it later.</p><p>— -</p><h3>Tracking Changes in Git</h3><p>Once a file is tracked, Git will always notice changes to it.</p><p>When you’re ready to save those changes, you commit them.</p><ul><li>Add once → Git starts tracking the file.</li><li>• Commit whenever you want → Git saves a snapshot of the current state.</li><li>• If you want to skip staging for tracked files, you can use:git commit -am “Updated file.txt with new content”</li></ul><p>— -</p><h3>Useful Commands</h3><ul><li>git status</li></ul><p>👉Shows the current state of your files — whether they are in the working directory, staged, or committed.</p><ul><li>•git log</li></ul><p>👉Displays the history of all commits made in the repository.</p><p>— -</p><p>Practice Task</p><p>Try creating a file, editing it multiple times, and using git add, git commit, git status, and git log to see how Git tracks each version.</p><p>— -</p><p>What’s Next</p><p>In the next session, we’ll cover:</p><ul><li>.gitignore → how to exclude files from tracking.</li><li>git reset → how to roll back to previous commits.</li><li>git commit — amend → how to fix or update your last commit.</li><li>how to untrack the file from the git which is being tracked</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=798fa37bb585" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>