DEV Community

Hope Gatugi
Hope Gatugi

Posted on

Understanding the Git Workflow: Working Directory, Staging, Commit and Push

Introduction

This article gives a better understanding of the git process for a beginner, have simplified it to the best of my knowledge as learnt during class .Below is an overview of the content learnt:

Project overview

Git helps you to understand the version control of your code on the GitHub

For beginners the workflow includes the following;
Creating a Working directory then after creating a directory you stage your code for commit into the GitHub
During committing you must leave a message behind for the next collaborator or version control
Then after Committing the code in the terminal , you use the git push command to send the codes your GitHub account
Here its visible to the public that is the people whom you want to see your work and you can as well choose to have the work private.
Where you save the repository as private or public.

Definition of terms

  1. working directory is where you store the codes locally on your machine. You can create or change your files here.
  2. committing it explains what you changed or like tells how the project is looking like.
  3. A repository this is like a project folder where ones project files are stored and git can keep track of their history and changes like date created ,time posted .

Stagging

staging tells git the changes i have made include the code in a file
command used to stage is git add .

Git commit

this is like creating a snapshot of the project and it is stored locally in the machine.
it is done using a command
git commit -m" message you want to leave for that version"

git push

this is more of sending your work to the git
after you have committed your work locally now you have to update it to the remote repository in your Github
it is done using the command
git push

Conclusion

Git basically helps us keep the track of our work and safely save different versions of our project. It makes it easier to manage our projects ,see what we have changed and then safely store the work.

Top comments (0)