<?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: Waweru</title>
    <description>The latest articles on DEV Community by Waweru (@waweru_8583fe284b383faf87).</description>
    <link>https://dev.to/waweru_8583fe284b383faf87</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%2F4070936%2Fa2c3e234-a3db-4f0f-a81f-e2f588dd7eb6.png</url>
      <title>DEV Community: Waweru</title>
      <link>https://dev.to/waweru_8583fe284b383faf87</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/waweru_8583fe284b383faf87"/>
    <language>en</language>
    <item>
      <title>Understanding the Git Workflow: Working Directory, Staging, Commit and Push</title>
      <dc:creator>Waweru</dc:creator>
      <pubDate>Sat, 22 Aug 2026 09:52:30 +0000</pubDate>
      <link>https://dev.to/waweru_8583fe284b383faf87/understanding-the-git-workflow-working-directory-staging-commit-and-push-5894</link>
      <guid>https://dev.to/waweru_8583fe284b383faf87/understanding-the-git-workflow-working-directory-staging-commit-and-push-5894</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Git is a version control system that tracks changes in code. When writing code we need to save every significant change or feature that does a certain function as a commit that can be reverted to if we ever need that instance of the code. This helps programmers to traverse code since nothing is ever lost in the product life cycle of the project. It also helps in debugging since we have a copy of the previous working state. So how do we start out with git you ask.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install git
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;a href="https://git-scm.com/install/" rel="noopener noreferrer"&gt;git&lt;/a&gt; for your specific operating system. After installing git you will note that the file comes with git bash which is a command line terminal that is used to run commands or instruct the version control git.&lt;/li&gt;
&lt;li&gt;To ensure that git has been installed open git bash and run the command &lt;code&gt;git --version&lt;/code&gt; which will return the version of git installed&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Download Visual Studio Code
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;a href="https://code.visualstudio.com/download?_exp_download=d53503e735" rel="noopener noreferrer"&gt;VS code&lt;/a&gt; a text editor for writing code.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Create a github account
&lt;/h2&gt;

&lt;p&gt;GitHub is a cloud-based platform used by developers to store,  track, and collaborate on software code. It operates as a hosting service for git, an open-source version control system that tracks changes made to files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Head over to &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;github&lt;/a&gt; and create and account&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating a directory tracked by git
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;On git bash run &lt;code&gt;mkdir &amp;lt;filename&amp;gt;&lt;/code&gt;. This will create a folder ie the project that will contain your files of code. &lt;/li&gt;
&lt;li&gt;Enter the folder through &lt;code&gt;cd &amp;lt;filename&amp;gt;&lt;/code&gt; and create a file README.md file which explains what this project does &lt;code&gt;touch README.md&lt;/code&gt;. Run the command &lt;code&gt;ls&lt;/code&gt; to list files in the directory&lt;/li&gt;
&lt;li&gt;Open the vs code from terminal by running &lt;code&gt;code .&lt;/code&gt; and edit the README.md file. Now the file is ready to be tracked by git on github&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Staging, committing and pushing
&lt;/h2&gt;

&lt;p&gt;We now need to initialize the directory making sure that git is now tracking the file. Running the commands &lt;code&gt;ls-la&lt;/code&gt; will confirm that git has been initialized in the repository. There are two ways of doing this either via the &lt;strong&gt;text editor VS code or the terminal&lt;/strong&gt;. Let us go through both.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. VS code
&lt;/h3&gt;

&lt;p&gt;Make sure your VS code is connected to your github account.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click the source control icon (third from top) and &lt;strong&gt;Initialize Repository&lt;/strong&gt;. This will introduce git to track the file&lt;/li&gt;
&lt;li&gt;Hover over the file and &lt;strong&gt;click the + button to add the file. This changes the file from U (untracked) to A (added)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Write the &lt;strong&gt;commit message in the input box above&lt;/strong&gt; describing what you are committing eg add README.md file.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;commit button press the drop down arrow **for more options and **press commit and sync&lt;/strong&gt;. This will now stage your repository to be pushed to github.&lt;/li&gt;
&lt;li&gt;Click on publish branch and set the repository to either public or private.&lt;/li&gt;
&lt;li&gt;Go to your github and refresh to see your newly pushed repository that is now tracked by git.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  2. Using the terminal
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open your terminal ie. gitbash  and go to your folder.&lt;/li&gt;
&lt;li&gt;Initialize Git using &lt;code&gt;git init&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add your files using &lt;code&gt;git add .&lt;/code&gt; to track them.&lt;/li&gt;
&lt;li&gt;Commit the files using &lt;code&gt;git commit -m "first commit"&lt;/code&gt;. This should describe what we are committing and will  to save the change locally.&lt;/li&gt;
&lt;li&gt;Link your remote repository using &lt;code&gt;git remote add origin &amp;lt;your-repo-url&amp;gt;&lt;/code&gt;.Preferably use the ssh link option &lt;/li&gt;
&lt;li&gt;Push the files using &lt;code&gt;git push -u origin main&lt;/code&gt; to send your code to GitHub and publish the repository as the main branch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With that now you know how to set up a project and keep track of your changes using github.&lt;/p&gt;

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