<?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: Mohammed</title>
    <description>The latest articles on DEV Community by Mohammed (@oxide-dev).</description>
    <link>https://dev.to/oxide-dev</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2988555%2Fb353721f-074e-428d-b2c9-145f078db957.png</url>
      <title>DEV Community: Mohammed</title>
      <link>https://dev.to/oxide-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/oxide-dev"/>
    <language>en</language>
    <item>
      <title>Git - basic commands and how to revert them</title>
      <dc:creator>Mohammed</dc:creator>
      <pubDate>Sat, 29 Mar 2025 12:06:04 +0000</pubDate>
      <link>https://dev.to/oxide-dev/git-basic-commands-and-how-to-revert-them-437b</link>
      <guid>https://dev.to/oxide-dev/git-basic-commands-and-how-to-revert-them-437b</guid>
      <description>&lt;p&gt;Git is a version control system that allows developers to collaborate and share code easily.&lt;/p&gt;

&lt;p&gt;You mostly already know what git is so let's get to the point,&lt;br&gt;
in this post I will share the basic commands that you'll use everyday and the commands to revert them&lt;/p&gt;
&lt;h2&gt;
  
  
  Unmodifying modified files
&lt;/h2&gt;

&lt;p&gt;To unmodify a file and revert it back to how it looked like in the last commit, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git restore &amp;lt;filename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Staging Files
&lt;/h2&gt;

&lt;p&gt;You can add a file to the staging area by running:&lt;br&gt;
you can also use a &lt;code&gt;.&lt;/code&gt; in place of the file name to select all files in the directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add &amp;lt;filename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you can unstage files by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git restore --staged &amp;lt;filename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Committing changes
&lt;/h2&gt;

&lt;p&gt;when you are done with your changes and have added your files to the staging area, then you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to undo your commit, use the &lt;code&gt;reset&lt;/code&gt; command which will destroy the commit and its changes, use the --soft option to keep the changes and put them in the staging area&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset HEAD~1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you only want to add more changes to the commit, or just change the commit message, then you can simply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit --amend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the &lt;code&gt;--amend&lt;/code&gt; option will get all the files in the staging area, put them in the previous commit, and ask you for a new commit message&lt;/p&gt;

&lt;p&gt;And there you go, the simple everyday git commands and how to revert them&lt;/p&gt;

</description>
      <category>git</category>
    </item>
  </channel>
</rss>
