<?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: Matt Drummond</title>
    <description>The latest articles on DEV Community by Matt Drummond (@mattdrmmnd).</description>
    <link>https://dev.to/mattdrmmnd</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%2F4157982%2F71d4c421-19a8-400d-bf59-8a5b9d63d5c5.jpg</url>
      <title>DEV Community: Matt Drummond</title>
      <link>https://dev.to/mattdrmmnd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mattdrmmnd"/>
    <language>en</language>
    <item>
      <title>Useful Git Bash Commands</title>
      <dc:creator>Matt Drummond</dc:creator>
      <pubDate>Tue, 27 Oct 2026 04:44:28 +0000</pubDate>
      <link>https://dev.to/mattdrmmnd/useful-git-bash-commands-4k80</link>
      <guid>https://dev.to/mattdrmmnd/useful-git-bash-commands-4k80</guid>
      <description>&lt;p&gt;With tools like Git Desktop and Git for vscode, having a basic understanding of git bash can still be very beneficial. It's also great to have alternatives in your workflow.&lt;/p&gt;

&lt;h4&gt;
  
  
  Here are some everyday commands that I find helpful.
&lt;/h4&gt;




&lt;h4&gt;
  
  
  Commands that reveal
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;                         &lt;span class="c"&gt;# List files and folders within directory&lt;/span&gt;
git status                    &lt;span class="c"&gt;# See what's changed on current directory&lt;/span&gt;

git diff                      &lt;span class="c"&gt;# Shows un-staged &amp;amp; staged difference&lt;/span&gt;
git diff &lt;span class="nt"&gt;--staged&lt;/span&gt;             &lt;span class="c"&gt;# Shows staged &amp;amp; most recent commit difference&lt;/span&gt;

git log &lt;span class="nt"&gt;--oneline&lt;/span&gt;             &lt;span class="c"&gt;# Displays each commit on one line&lt;/span&gt;
git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--parents&lt;/span&gt;   &lt;span class="c"&gt;# Shows parent-child relationship in log &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Create a new git repository
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ..                &lt;span class="c"&gt;# Go to parent directory (main)&lt;/span&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;dir-name       &lt;span class="c"&gt;# Make a new directory and name it&lt;/span&gt;
git init             &lt;span class="c"&gt;# Creates a new repository in the directory ".git"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Modify file structure
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;file-name-01 file-name-02   &lt;span class="c"&gt;# Create 1 or more files&lt;/span&gt;
&lt;span class="nb"&gt;rm &lt;/span&gt;file-name-01                   &lt;span class="c"&gt;# Remove a file&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Stage, Commit push to remote repository
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="k"&gt;*&lt;/span&gt;                           &lt;span class="c"&gt;# Stage all files&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"your message here"&lt;/span&gt;   &lt;span class="c"&gt;# Commit and add message&lt;/span&gt;
git push                            &lt;span class="c"&gt;# Sends commit to GitHub&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Override most recent commit with new changes
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add my_file.html   &lt;span class="c"&gt;# Stage 1 file&lt;/span&gt;
git add &lt;span class="k"&gt;*&lt;/span&gt;              &lt;span class="c"&gt;# Stage all files&lt;/span&gt;

git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;--no-edit&lt;/span&gt;  &lt;span class="c"&gt;# Commit update &amp;amp; keep previous message&lt;/span&gt;
git push &lt;span class="nt"&gt;--force-with-lease&lt;/span&gt;   &lt;span class="c"&gt;# Push update to remote repository&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h4&gt;
  
  
  Branch / Merge
&lt;/h4&gt;

&lt;p&gt;Note: Before merging, ensure you are on the correct branch (usually main) before proceeding.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch branch_name      &lt;span class="c"&gt;# Creates new "FEATURE" branch&lt;/span&gt;
git switch branch_name      &lt;span class="c"&gt;# Go to a different branch&lt;/span&gt;
git switch &lt;span class="nt"&gt;-c&lt;/span&gt; branch_name   &lt;span class="c"&gt;# Creates and switches to new branch&lt;/span&gt;

git branch                  &lt;span class="c"&gt;# Shows all branches   &lt;/span&gt;
git merge branch_name       &lt;span class="c"&gt;# Merges branch into main&lt;/span&gt;
git branch &lt;span class="nt"&gt;-d&lt;/span&gt; branch_name   &lt;span class="c"&gt;# Deletes the merged branch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>git</category>
      <category>github</category>
      <category>bash</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
