<?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: sam manox</title>
    <description>The latest articles on DEV Community by sam manox (@sam_manox).</description>
    <link>https://dev.to/sam_manox</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%2F4086125%2F347b72d1-f120-422f-bf6f-a3353dc9dd85.jpg</url>
      <title>DEV Community: sam manox</title>
      <link>https://dev.to/sam_manox</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sam_manox"/>
    <language>en</language>
    <item>
      <title>Understanding the Git Workflow: Working Directory, Staging, Commit, and Push</title>
      <dc:creator>sam manox</dc:creator>
      <pubDate>Sun, 23 Aug 2026 05:51:48 +0000</pubDate>
      <link>https://dev.to/sam_manox/understanding-the-git-workflow-working-directory-staging-commit-and-push-14c9</link>
      <guid>https://dev.to/sam_manox/understanding-the-git-workflow-working-directory-staging-commit-and-push-14c9</guid>
      <description>&lt;p&gt;The first time we were introduced to Git, we really didn't know where our code was going to be saved until I learned that Git is part of a control system. It keeps track of changes made to files in a project so you can: track what changed, see previous versions of what you were working on to undo mistakes, work on different features, collaborate with others on the code or project we were working on, and back up projects to GitHub. Once you have added the knowledge of the stages of a Git workflow, then you have total control of your project from the previous history to the current workspace.&lt;br&gt;
During our learning, we were able to cover four stages of a Git workflow: working directory, staging, committing to the local repository, and pushing to the remote repository.&lt;/p&gt;
&lt;h2&gt;
  
  
  Working Directory
&lt;/h2&gt;

&lt;p&gt;This is our working directory where we type our code, a folder where our code lives. When opening a file in the code editor and making changes, we are working in the Working Directory; at this moment Git is aware that something has changed, but it hasn't recorded anything permanently yet. If we check the status by writing a command like git status, it will show the files that have been modified or deleted. Here, the changes are tracked but not yet saved.&lt;br&gt;
Suppose we edited a file here, and we check the status. Git sees the changes, but they are unstaged. For example &lt;br&gt;
SQL CODE like;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="n"&gt;customer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;product_id&lt;/span&gt; 
            &lt;span class="k"&gt;From&lt;/span&gt; &lt;span class="n"&gt;Customers&lt;/span&gt;
&lt;span class="k"&gt;Then&lt;/span&gt; &lt;span class="n"&gt;we&lt;/span&gt; &lt;span class="n"&gt;make&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;change&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;this&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="s1"&gt;'s say 
        Select customer_id, product_id,
            Sum (sales_amount) AS total_amount
            From customers 
            Group by customer_id
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, the code has changed in your code editor but no permanent version of this on Git, so this is the working directory.  The changes haven’t been committed; it tells you I can see the changes, but you haven’t told me to include them in Git.&lt;/p&gt;

&lt;h2&gt;
  
  
  Staging area
&lt;/h2&gt;

&lt;p&gt;This is the preparation stage for me, like telling Git to take this screenshot and prepare it for a more committed state. Include these changes in my next commit. If we were working on a data analysis project, you would tell Git to bash.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;/&amp;gt;Bash
Add sql/analysis.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then check the status&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;/&amp;gt;Bash
git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result will be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;changes to be committed:
    Modified: sql/analysis.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file is now staged, and Git lets you choose which changes to include in your next commit.&lt;br&gt;
We move changes from the Working Directory into the Staging Area using:&lt;br&gt;
&lt;code&gt;git add &amp;lt;filename&amp;gt;&lt;/code&gt;&lt;br&gt;
Or, to stage everything that has changed:&lt;br&gt;
&lt;code&gt;git add&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Staging gives a chance to know what to commit at each stage, making it clear and clean, and it is a preview stage.&lt;/p&gt;
&lt;h2&gt;
  
  
  The commit (Local Repository)
&lt;/h2&gt;

&lt;p&gt;Now, since our changes have been staged, we save them permanently to project history using the commit command.&lt;br&gt;
git commit -m "A clear, descriptive message about what changed"&lt;br&gt;
like; &amp;lt;/&amp;gt; bash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Added customer sales analysis"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a commit that is a snapshot of the changes that you have made and is stored in the local repository. We also know that the commit at this stage has a unique ID, the author's email and name, a commit message, and a timestamp, including the reference to the previous commit.&lt;br&gt;
The commits at this stage are stored locally; no one can access them, and they are a permanent safe place where you can come back to refer to if you make any errors at a given point.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Push (Remote Repository)
&lt;/h2&gt;

&lt;p&gt;Everything that we have been doing from the beginning to this point has just been happening on our computers or on our code editor platform; to share this information with our team, like we have been working on the health report in Kenya, and we have been cleaning that data, and we want to share those changes we have made, we have to push the commits to a Remote Repository like GitHub or GitLab. This can be achieved through;&lt;br&gt;
&lt;code&gt;git push origin main&lt;/code&gt;&lt;br&gt;
Here, &lt;em&gt;origin&lt;/em&gt; is the default name Git gives to the remote repository you added manually, and main is the branch you're pushing to.&lt;br&gt;
Once the changes have been pushed, the commit is available for access by anyone with access to your local repository. Now your work has been shared with your teammates. It is always a good habit to check for updates before pushing your commit.&lt;/p&gt;

&lt;p&gt;These stages are more important as a beginner; I used to ask why you just save directly, as Google Docs does, then I realized that software projects sometimes are more complex. Git stages give you control over what to commit at each stage; you can make changes to any errors you may have before committing them or saving them permanently, and you can understand each stage of your project or code history. Without forgetting, pushing and pulling help you collaborate with others, making work easier.&lt;br&gt;
&lt;code&gt;Work you edit your file normally&lt;br&gt;
git add &amp;lt;file&amp;gt;   you make changes to be included.&lt;br&gt;
git commit -m "message"   saves permanently&lt;br&gt;
git push origin &amp;lt;branch&amp;gt;   uploads commits to be shared&lt;br&gt;
git status  shows what changed, staged.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Each stage exists for a specific reason.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>git</category>
      <category>learning</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
