<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Selva</title>
    <description>The latest articles on DEV Community by Selva (@selva_j).</description>
    <link>https://dev.to/selva_j</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3080283%2F4203d4d0-b0fa-41a9-9ecc-f906cab9acda.png</url>
      <title>DEV Community: Selva</title>
      <link>https://dev.to/selva_j</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/selva_j"/>
    <language>en</language>
    <item>
      <title>Mastering Advanced Git Commands: A Practical Guide</title>
      <dc:creator>Selva</dc:creator>
      <pubDate>Mon, 28 Apr 2025 15:40:43 +0000</pubDate>
      <link>https://dev.to/selva_j/mastering-advanced-git-commands-a-practical-guide-4a9d</link>
      <guid>https://dev.to/selva_j/mastering-advanced-git-commands-a-practical-guide-4a9d</guid>
      <description>&lt;p&gt;If you’ve been using Git for a while, you probably know the basics — clone, commit, push, pull.&lt;br&gt;
But Git is a powerful tool, and there's a whole world beyond the basics that can make your workflow faster, cleaner, and smarter.&lt;/p&gt;

&lt;p&gt;In this blog, we'll dive into advanced Git commands that every developer should know!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;git stash&lt;/strong&gt; — Save Work Without Committing
Ever got stuck when you need to switch branches but don’t want to commit half-done work?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;git stash&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It saves your changes in a "stash" and cleans your working directory.&lt;/p&gt;

&lt;p&gt;Later, you can reapply the stashed changes with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git stash pop&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Tip: You can even stash with a message:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git stash save "WIP: fixing login bug"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2.&lt;strong&gt;git cherry-pick&lt;/strong&gt; — Apply Specific Commits&lt;br&gt;
Want to pick a single commit from one branch and apply it to another?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git cherry-pick &amp;lt;commit-hash&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Great for moving small bug fixes without merging entire branches.&lt;/p&gt;

&lt;p&gt;3.&lt;strong&gt;git rebase&lt;/strong&gt;— Rewrite History Cleanly&lt;br&gt;
Instead of a messy merge, you can reapply commits on top of another branch:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout feature-branch&lt;br&gt;
git rebase main&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Makes history linear and clean.&lt;/p&gt;

&lt;p&gt;Interactive rebasing (git rebase -i) even lets you squash commits together!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git rebase -i HEAD~5&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can pick, squash, or reword commits easily during interactive rebase.&lt;/p&gt;

&lt;p&gt;4.&lt;strong&gt;git reflog&lt;/strong&gt; — Find Lost Commits&lt;br&gt;
Deleted a branch or a commit accidentally?  Don’t worry!&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git reflog&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It shows a log of everything you've done, including commits that aren't reachable anymore.&lt;/p&gt;

&lt;p&gt;You can recover with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git checkout &amp;lt;commit-hash&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;5.&lt;strong&gt;git reset&lt;/strong&gt; — Undo Changes&lt;br&gt;
Soft reset (keep changes but unstage):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git reset --soft HEAD~1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Mixed reset (unstage and keep working directory):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git reset --mixed HEAD~1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Hard reset (dangerous! discard changes):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git reset --hard HEAD~1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Use hard resets carefully — once changes are gone, they're usually gone for good unless you use reflog.&lt;/p&gt;

&lt;p&gt;6.&lt;strong&gt;git bisect&lt;/strong&gt; — Find Bugs Faster&lt;br&gt;
Git can automatically help you find the commit where a bug was introduced!&lt;/p&gt;

&lt;p&gt;Start bisecting:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git bisect start&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Mark the current version as bad:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git bisect bad&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Mark an older working version as good:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git bisect good &amp;lt;commit-hash&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Git will checkout commits one by one — you test and tell Git whether it's "good" or "bad" until it narrows down the exact problematic commit.&lt;/p&gt;

&lt;p&gt;7.&lt;strong&gt;git tag&lt;/strong&gt; — Mark Important Points&lt;br&gt;
Use tags for releases, versions, or milestones.&lt;/p&gt;

&lt;p&gt;Create a lightweight tag:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git tag v1.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create an annotated tag:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git tag -a v1.0 -m "Release version 1.0"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Push tags:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push origin v1.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or push all tags:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git push origin --tags&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;8.&lt;strong&gt;git clean&lt;/strong&gt; — Remove Untracked Files&lt;br&gt;
Want to remove junk (files not tracked by Git)?&lt;/p&gt;

&lt;p&gt;Preview what would be deleted:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clean -n&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Actually delete them:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git clean -f&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Be very careful with git clean — it’s powerful!&lt;/p&gt;

&lt;p&gt;9.&lt;strong&gt;git remote prune&lt;/strong&gt; — Clean Up Deleted Branches&lt;br&gt;
Sometimes remote branches get deleted, but you still see them locally. Clean them up with:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git remote prune origin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;10.&lt;strong&gt;git shortlog&lt;/strong&gt; — Summarize Contributions&lt;br&gt;
Want to generate a quick summary of who contributed?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git shortlog -sn&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You'll get a list of contributors sorted by the number of commits!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Learning these advanced Git commands will:&lt;/p&gt;

&lt;p&gt;Save you time&lt;/p&gt;

&lt;p&gt;Help you recover faster&lt;/p&gt;

&lt;p&gt;Keep your repositories cleaner&lt;/p&gt;

&lt;p&gt;Impress your team!&lt;/p&gt;

&lt;p&gt;If you're serious about becoming a Git pro, practice these commands on a test repository first.&lt;br&gt;
Over time, they’ll become second nature.&lt;/p&gt;

&lt;p&gt;If you found this helpful, don't forget to ❤️ the post and follow for more tips!&lt;br&gt;
Feel free to comment your favorite Git tricks below! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>DockerFile Image Creation and Pushing to DockerHub</title>
      <dc:creator>Selva</dc:creator>
      <pubDate>Fri, 25 Apr 2025 17:37:51 +0000</pubDate>
      <link>https://dev.to/selva_j/dockerfile-image-creation-and-pushing-to-dockerhub-236g</link>
      <guid>https://dev.to/selva_j/dockerfile-image-creation-and-pushing-to-dockerhub-236g</guid>
      <description>&lt;p&gt;Whether you're a developer automating deployments or a student getting started with DevOps, learning how to create Docker images and push them to DockerHub is essential. In this post, we’ll walk through:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Writing a simple Dockerfile&lt;/li&gt;
&lt;li&gt;Building a Docker image&lt;/li&gt;
&lt;li&gt;Tagging the image&lt;/li&gt;
&lt;li&gt;Pushing it to DockerHub&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s get started!&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;What is a Dockerfile?&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;A Dockerfile is a plain text file that contains instructions on how to build a Docker image. Think of it as a recipe — it tells Docker how to build an environment tailored for your application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dockerfile
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
FROM python:3.14.0a7-alpine3.21

# Install required system dependencies
RUN apk add --no-cache build-base musl-dev linux-headers

# Install Python libraries
RUN pip install --upgrade pip &amp;amp;&amp;amp; \
    pip install pandas scikit-learn matplotlib

# Copy and run your script
COPY . .
CMD [ "python", "hello_world_ml.py" ]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;1. Build the Docker Image&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker build -t DockerUserName/dockerfilename:latest .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Run the Docker Image&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run --rm DockerUserName/dockerfilename:latest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. List Docker Images&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker image ls&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Push the Image to DockerHub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker push DockerUserName/dockerfilename:latest&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GITHUB commands</title>
      <dc:creator>Selva</dc:creator>
      <pubDate>Wed, 23 Apr 2025 16:49:57 +0000</pubDate>
      <link>https://dev.to/selva_j/github-commands-d2o</link>
      <guid>https://dev.to/selva_j/github-commands-d2o</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Step-by-Step Git Commands Execution:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Initialize a Git repository:&lt;/strong&gt;&lt;br&gt;
    &lt;code&gt;git init&lt;/code&gt;&lt;br&gt;
Creates a new Git repository in the folder 24MCR095.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add a file to staging area:&lt;/strong&gt;&lt;br&gt;
    &lt;code&gt;git add 24MCR095.txt&lt;/code&gt;&lt;br&gt;
Adds 24MCR095.txt to the staging area.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commit the file:&lt;/strong&gt;&lt;br&gt;
    &lt;code&gt;git commit -m "Added Personal Details"&lt;/code&gt;&lt;br&gt;
Creates a commit with the message "Added Personal Details".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check Git status:&lt;/strong&gt;&lt;br&gt;
     &lt;code&gt;git status&lt;/code&gt;&lt;br&gt;
Shows that 24MCR095.txt has been modified but not staged.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;View commit log:&lt;/strong&gt;&lt;br&gt;
     &lt;code&gt;git log&lt;/code&gt;&lt;br&gt;
Displays the commit history (one commit at this point).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add remote GitHub repository:&lt;/strong&gt;&lt;br&gt;
     &lt;code&gt;git remote add origin https://github.com/selva192003/24MCR095.git&lt;/code&gt;&lt;br&gt;
Links the local repository to a remote GitHub repo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check current branch:&lt;/strong&gt;&lt;br&gt;
    &lt;code&gt;git branch&lt;/code&gt;&lt;br&gt;
Shows the current branch is master.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rename branch from master to main:&lt;/strong&gt;&lt;br&gt;
    &lt;code&gt;git branch -M main&lt;/code&gt;&lt;br&gt;
Renames the current branch to main.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set Git global config for email and username:&lt;/strong&gt;&lt;br&gt;
    &lt;code&gt;git config --global user.email "dhoniselva192003@gmail.com"&lt;br&gt;
        git config --global user.name "selva192003"&lt;/code&gt;&lt;br&gt;
Sets your global Git identity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Push code to remote repo for the first time:&lt;/strong&gt;&lt;br&gt;
     &lt;code&gt;git push -u origin main&lt;/code&gt;&lt;br&gt;
Pushes the main branch to GitHub and sets upstream tracking.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Sample Screenshots:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2reb4ei3gr1fmlp4q9k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2reb4ei3gr1fmlp4q9k.jpg" alt="Image description" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fye4ny2jutk1uge9fibf5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fye4ny2jutk1uge9fibf5.jpg" alt="Image description" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxo7fo82ajbwbn28ks4lg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxo7fo82ajbwbn28ks4lg.jpg" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwo2dcx4on6j4t7ajcg6z.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwo2dcx4on6j4t7ajcg6z.jpg" alt="Image description" width="800" height="272"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Then , Again We will Modify or add new file means we need to follow the same steps, like&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .
git commit -m “message”
git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Git Commands used in this session:&lt;/strong&gt;
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git init
git clone &amp;lt;repo_url&amp;gt;
git status
git add &amp;lt;file&amp;gt;
git add .
git commit -m "Your message"
git branch
git branch &amp;lt;branch_name&amp;gt;
git checkout &amp;lt;branch_name&amp;gt;
git checkout -b &amp;lt;branch_name&amp;gt;
git pull origin &amp;lt;branch_name&amp;gt;
git push origin &amp;lt;branch_name&amp;gt;
git merge &amp;lt;branch_name&amp;gt;
git rebase &amp;lt;branch_name&amp;gt;
git restore &amp;lt;file&amp;gt;
git reset --soft HEAD~1
git reset --hard HEAD~1


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>github</category>
      <category>devops</category>
      <category>learning</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
