<?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: Esther Karanja</title>
    <description>The latest articles on DEV Community by Esther Karanja (@esther_karanja_).</description>
    <link>https://dev.to/esther_karanja_</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%2F4071737%2F5e5f4715-7798-4f26-aa45-bd0b53cb8007.jpeg</url>
      <title>DEV Community: Esther Karanja</title>
      <link>https://dev.to/esther_karanja_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/esther_karanja_"/>
    <language>en</language>
    <item>
      <title>Understanding the Git Workflow:Working directory,staging ,commit and push.</title>
      <dc:creator>Esther Karanja</dc:creator>
      <pubDate>Fri, 21 Aug 2026 22:22:18 +0000</pubDate>
      <link>https://dev.to/esther_karanja_/understanding-the-git-workflowworking-directorystaging-commit-and-push-2b3j</link>
      <guid>https://dev.to/esther_karanja_/understanding-the-git-workflowworking-directorystaging-commit-and-push-2b3j</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Understanding git has become easier for me when broken down into this four stages.&lt;br&gt;
The working directory is where we write code,amend and delete files,here changes are made but can not be tracked unless they are instructed to commit.&lt;br&gt;
The staging phase is an area where files are modified.&lt;br&gt;
The commit phase is where git takes everything from the staging area and sends it to our local repository,&lt;br&gt;
The push phase is where the saved commits are sent to a remote repository like github.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Git&lt;/strong&gt; is a version control system or tool used to track changes by developers.&lt;br&gt;
When one installs git it comes with an inbuilt terminal called &lt;strong&gt;gitbash&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding how Git works.
&lt;/h2&gt;

&lt;p&gt;We start by installing git on my Pc, after installation is done one can check if git is installed by opening a terminal eg powershell on windows and run &lt;code&gt;git --version&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to create folders and files on git bash
&lt;/h2&gt;

&lt;p&gt;First identify where we want the folder to be located&lt;br&gt;
&lt;code&gt;ls&lt;/code&gt;is used to list&lt;br&gt;
&lt;code&gt;mkdir "name of the folder" (means make directory)&lt;br&gt;
&lt;/code&gt;&lt;code&gt;cd " name of the folder"&lt;/code&gt;(change directory)&lt;/p&gt;

&lt;p&gt;Readme texts &lt;code&gt;README.md&lt;/code&gt;end with .md since they are written using markdown language.Can use echo,touch or nano commands to write a readme file.&lt;br&gt;
If i want to know the contents of my readme file we use:&lt;code&gt;cat README.md&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;git config-this is basically telling it my identity&lt;br&gt;
&lt;code&gt;git config --user.name"Esther Karanja"&lt;/code&gt;&lt;br&gt;
&lt;code&gt;git config --user.email "my email"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git init-this command is used to create or initialize a repository in main/master.&lt;br&gt;
&lt;code&gt;git init main&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git status-shows the repository status. This command shows changes and what is happening in git&lt;br&gt;
&lt;code&gt;git status&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git add-stages changes made&lt;br&gt;
&lt;code&gt;git add .&lt;/code&gt;this means stage all or one can specify what to be added e.g i want to add only a javascript folder &lt;code&gt;git add script.js&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git commit-commits records that have been staged in the &lt;strong&gt;local git repository&lt;/strong&gt;.Its like getting a snapshot or memory of the file.&lt;br&gt;
&lt;code&gt;git commit -m "write a commit message"&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git log-shows a history of all the commits that were made.&lt;br&gt;
&lt;code&gt;git log&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;git branch&lt;/code&gt; should return main &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To upload my git folder on github:&lt;/strong&gt;&lt;br&gt;
Open the github account,create a new repository,click on ssh and copy the link&lt;br&gt;
&lt;code&gt;git remote add origin "paste the ssh key link"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git remote -v&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;git push-this command to send commits to the &lt;strong&gt;remote repository&lt;/strong&gt;
&lt;code&gt;git push -u origin main&lt;/code&gt;
Git will send the files to my github repository,i can refresh my github and see them&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is github?
&lt;/h2&gt;

&lt;p&gt;Github is a cloud based platform for storing git repositories online.&lt;br&gt;
Just sign up for free,verify via email and your account is created.&lt;br&gt;
git and github are connected using a SSH KEY.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a SSH KEY?
&lt;/h2&gt;

&lt;p&gt;SSH stands for secure shell which is a protocol that allows a computer to communicate with another computer over a network.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So how do i generate an SSH key?&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ssh-keygen -t ed25519 -C "email signed on github.com"&lt;/code&gt;and press enter, the passphase(password authentication)is optional.&lt;br&gt;
This command will generate two keys:example&lt;br&gt;
ed25519&lt;br&gt;
ed25519.pub&lt;br&gt;
The one with &lt;strong&gt;.pub&lt;/strong&gt; is the public key which is the one that we share with github while the other one is a private key which should not be shared.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to add the SSH Key to Github&lt;/strong&gt;-open my github account,on settings click on SSH and GPG keys, create a new key and copy the public key that we generated.&lt;br&gt;
&lt;strong&gt;How to test the SSH connection&lt;/strong&gt;&lt;br&gt;
Test before pushing a project using &lt;code&gt;ssh -T git@github.com&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In conclusion,i can say that using git and github is easier than i thought,the commands are self explanatory.Basically,i just create my project locally,initialize git,connect my github account and git together using the SSH keys, create a repository,commit and push them to my github account &lt;/p&gt;

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