<?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: Trevor Zabar</title>
    <description>The latest articles on DEV Community by Trevor Zabar (@zabartrevor).</description>
    <link>https://dev.to/zabartrevor</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%2F4071751%2F6a4c7790-3941-46d0-8102-a02efea6a7db.png</url>
      <title>DEV Community: Trevor Zabar</title>
      <link>https://dev.to/zabartrevor</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zabartrevor"/>
    <language>en</language>
    <item>
      <title>Understanding the Git Workflow: Working Directory, Staging, Commit, and Push</title>
      <dc:creator>Trevor Zabar</dc:creator>
      <pubDate>Sun, 23 Aug 2026 07:02:32 +0000</pubDate>
      <link>https://dev.to/zabartrevor/understanding-the-git-workflow-working-directory-staging-commit-and-push-485h</link>
      <guid>https://dev.to/zabartrevor/understanding-the-git-workflow-working-directory-staging-commit-and-push-485h</guid>
      <description>&lt;p&gt;When I first started learning Git, commands such as &lt;code&gt;git add&lt;/code&gt;, &lt;code&gt;git commit&lt;/code&gt;, and &lt;code&gt;git push&lt;/code&gt; seemed like separate steps that were easy to confuse. After practicing the Git workflow, I understood that each command moves changes to a different stage.&lt;br&gt;
The complete workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Working Directory → Staging Area → Local Repository → Remote Repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this article, I will explain each stage using a simple website project.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Git?
&lt;/h2&gt;

&lt;p&gt;Git is a version control system that tracks changes in a project. It allows developers to save different versions of their work and review or restore earlier versions when necessary.&lt;/p&gt;

&lt;p&gt;GitHub is an online platform where Git repositories can be stored and shared. Git works on your computer, while GitHub stores a copy of your repository online.&lt;/p&gt;

&lt;p&gt;The important difference is that saving a commit locally does not automatically upload it to GitHub. You must push the commit separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Working Directory
&lt;/h2&gt;

&lt;p&gt;The working directory is the project folder on your computer. It contains the files you are currently creating or editing.&lt;/p&gt;

&lt;p&gt;For example, imagine a website project with the following files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-website/
├── index.html
├── style.css
└── script.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I open &lt;code&gt;index.html&lt;/code&gt; and change the heading, the change first exists in the working directory.&lt;/p&gt;

&lt;p&gt;At this point, Git knows that the file has changed, but the change has not been prepared for saving yet. I can check the condition of the project with:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Git may display something similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Changes not staged for commit:
  modified:   index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that &lt;code&gt;index.html&lt;/code&gt; has been changed, but it is not yet in the staging area.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Staging Area
&lt;/h2&gt;

&lt;p&gt;The staging area is where I select the changes that I want to include in my next commit.&lt;br&gt;
To stage the modified file, I run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I check the status again:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The output may now look like this:&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:   index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file is now ready to be committed, but it has not been permanently saved in the project history yet.&lt;/p&gt;

&lt;p&gt;I can stage more than one file by listing the filenames:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add index.html style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can also stage all changed files with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although &lt;code&gt;git add .&lt;/code&gt; is convenient, I should check the files before committing. It may stage files that I did not intend to include.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Staging Area Matters
&lt;/h2&gt;

&lt;p&gt;The staging area gives me control over what goes into a commit.&lt;/p&gt;

&lt;p&gt;For example, suppose I make changes to two files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I add a completed navigation bar to &lt;code&gt;index.html&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I experiment with unfinished styles in &lt;code&gt;style.css&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If I want to commit only the navigation bar, I can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add index.html
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add navigation bar"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The changes in &lt;code&gt;style.css&lt;/code&gt; will remain in the working directory and will not be included in the commit.&lt;/p&gt;

&lt;p&gt;This makes it possible to create focused commits. Each commit can describe one meaningful change instead of containing a mixture of unrelated work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Commit
&lt;/h2&gt;

&lt;p&gt;A commit is a saved record of staged changes. It represents a particular version of the project.&lt;/p&gt;

&lt;p&gt;After staging &lt;code&gt;index.html&lt;/code&gt;, I can create a commit with:&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;"Update homepage heading"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The message after &lt;code&gt;-m&lt;/code&gt; explains what the commit contains.&lt;/p&gt;

&lt;p&gt;Good commit messages include:&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;"Add contact form"&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Fix mobile navigation"&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Update project documentation"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Messages such as these are less useful:&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;"Changes"&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Update"&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Work"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A good commit message should be short, clear, and specific.&lt;/p&gt;

&lt;p&gt;When I commit changes, they are saved in my local Git repository. They are not yet available on GitHub.&lt;/p&gt;

&lt;p&gt;To view the project history, I can run:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;For a shorter version of the history, I can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A short log may look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a31f9c2 Add contact form
e72b410 Update homepage heading
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each commit has a unique identifier that Git uses to distinguish it from other commits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pushing to GitHub
&lt;/h2&gt;

&lt;p&gt;A remote repository is the online version of a Git repository. For many projects, the remote repository is hosted on GitHub.&lt;/p&gt;

&lt;p&gt;After creating a commit locally, I can upload it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;origin&lt;/code&gt; is the name of the remote repository.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;main&lt;/code&gt; is the branch I am pushing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference between committing and pushing is important:&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 = Save changes in the local repository
git push   = Upload local commits to the remote repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running &lt;code&gt;git commit&lt;/code&gt; does not automatically update GitHub. I must run &lt;code&gt;git push&lt;/code&gt; to send the commit to the remote repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Complete Example
&lt;/h2&gt;

&lt;p&gt;Suppose I want to add a welcome message to my website.&lt;/p&gt;

&lt;p&gt;First, I check the current status:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Next, I edit &lt;code&gt;index.html&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome to My Website&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can review the changes before staging them:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;git diff&lt;/code&gt; command shows changes that have not been staged.&lt;/p&gt;

&lt;p&gt;Next, I stage the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I check the status again:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Now I create a commit:&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;"Add welcome message"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, I push the commit to GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The complete workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
git diff
git add index.html
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add welcome message"&lt;/span&gt;
git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each command has a separate purpose:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;git status&lt;/code&gt; shows the current state of the project.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git diff&lt;/code&gt; shows the changes made to files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git add&lt;/code&gt; selects changes for the next commit.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git commit&lt;/code&gt; saves the staged changes locally.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git push&lt;/code&gt; uploads the commit to GitHub.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Starting Git in a Project
&lt;/h2&gt;

&lt;p&gt;If I am working on a new project, I first move into the project folder:&lt;br&gt;
&lt;/p&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;my-website
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I initialize Git:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This creates a hidden &lt;code&gt;.git&lt;/code&gt; folder that stores the project's Git information and history.&lt;br&gt;
I can check the project status with:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;If the project contains files that Git has not tracked before, they will appear as untracked files.&lt;/p&gt;

&lt;p&gt;I can add all the files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I create the first commit:&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;"Initial project setup"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I have already created an empty repository on GitHub, I can connect the local repository to it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add origin https://github.com/your-username/my-website.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can make sure the branch is called &lt;code&gt;main&lt;/code&gt;:&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 &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I push the project to GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-u&lt;/code&gt; option links the local branch to the remote branch. After this first push, I can usually use:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reviewing Staged Changes
&lt;/h2&gt;

&lt;p&gt;It is useful to review changes before committing them.&lt;/p&gt;

&lt;p&gt;The following command shows changes that have not been staged:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;After using &lt;code&gt;git add&lt;/code&gt;, I can review the changes that are ready to be committed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git diff &lt;span class="nt"&gt;--staged&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The difference is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git diff          = Shows unstaged changes
git diff --staged = Shows staged changes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This extra check can help me catch mistakes before they become part of the project history.&lt;/p&gt;

&lt;h2&gt;
  
  
  Removing a File from the Staging Area
&lt;/h2&gt;

&lt;p&gt;Sometimes I may stage a file by mistake. I can remove it from the staging area without deleting it from my computer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git restore &lt;span class="nt"&gt;--staged&lt;/span&gt; style.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The changes in &lt;code&gt;style.css&lt;/code&gt; will remain in the working directory, but they will not be included in the next commit.&lt;/p&gt;

&lt;p&gt;This command only unstages the file. It does not delete the file or remove the changes I made.&lt;/p&gt;

&lt;h2&gt;
  
  
  Discarding Changes
&lt;/h2&gt;

&lt;p&gt;If I decide that I do not want to keep changes in a file, I can restore it to the version from the latest commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git restore index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This removes the unstaged changes in &lt;code&gt;index.html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I should use this command carefully because the discarded changes may not be easy to recover. Before running it, I can check what will be removed with:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common Beginner Mistakes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Forgetting to Stage Changes
&lt;/h3&gt;

&lt;p&gt;If I run &lt;code&gt;git commit&lt;/code&gt; before staging a file, Git may tell me that there is nothing to commit.&lt;/p&gt;

&lt;p&gt;The correct sequence is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add index.html
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Describe the change"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Thinking a Commit Is the Same as a Push
&lt;/h3&gt;

&lt;p&gt;A commit saves changes locally. A push uploads those local commits to GitHub.&lt;/p&gt;

&lt;p&gt;The commands are separate:&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;"Save my changes"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Using Unclear Commit Messages
&lt;/h3&gt;

&lt;p&gt;A message such as &lt;code&gt;"Update"&lt;/code&gt; does not provide enough information about the change.&lt;/p&gt;

&lt;p&gt;A clearer message would be:&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;"Fix incorrect signup link"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Committing Without Checking
&lt;/h3&gt;

&lt;p&gt;Before committing, I should inspect the staged files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
git diff &lt;span class="nt"&gt;--staged&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helps prevent accidental commits containing unfinished work, temporary files, or sensitive information.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Simple Way to Remember the Workflow
&lt;/h2&gt;

&lt;p&gt;I think of the Git workflow as preparing and sending a parcel.&lt;/p&gt;

&lt;p&gt;The working directory is my desk, where I work on the contents. The staging area is where I choose what should go into the parcel. The commit is like sealing and labeling the parcel, while pushing is like sending it to the online destination.&lt;/p&gt;

&lt;p&gt;The commands follow the same idea:&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       Choose what to include
git commit    Save the selected changes locally
git push      Share the saved changes online
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Workflow
&lt;/h2&gt;

&lt;p&gt;For everyday Git work, I can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Describe what changed"&lt;/span&gt;
git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I am unsure about the state of my project, I start with:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The most important lesson is that changes move through separate stages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Edit files
   ↓
Working Directory
   ↓ git add
Staging Area
   ↓ git commit
Local Repository
   ↓ git push
Remote Repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once I understand this process, Git commands become easier to remember. I am not just running commands randomly; I am deliberately moving my work from one stage to the next.&lt;/p&gt;

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