Git (DevOps 3)

Hello everyone,

I am Batool Fatima. I am 18 years old. I have been learning DevOps for a month now. This is my third code blog. In last blog, I wrote about Git and some keywords of git. Today, Let's learn about workflow of Git with me.

Stages/Workflow Of Git-

Git works in three stages. They are-

  1. Workspace or Working Directory- It is the directory where git stores the files that are being modified, tracked and controlled. It is also called the untracked area of git. Here if you make changes and do not save them to the git then you will loose your the changes made to the file.

  2. Staging Area- The staging area is a place to record things before committing.

    From working directory, you send the file to staging area by using 'git add .' command and here git starts saving and tracking the changes done to the file. Staging helps you "check off" individual changes as you review a complex commit, and to concentrate on the stuff that has not yet passed your review.

  3. Local Repository- The Local Repository is everything in your .git directory. Mainly what you will see in your Local Repository are all of your checkpoints or commits. It is the area that saves everything. The git command 'git commit'

    takes all changes in the Staging Area, wraps them together and puts them in your Local Repository.

    Now let's talk what is adding and committing.

    Look, The command used to stage any change in Git is git add. The git add command adds a modification to the staging area from the working directory. It informs Git that you wish to include changes to a specific file in the next commit. However, git add has little effect on the repository. Changes are not truly recorded until you execute git commit. The git commit command saves a snapshot of the current staged changes in the project. Committed snapshots are “secure” versions of a project that Git will never alter unless you specifically ask it to.

    Now Let's have look on what are different types of repositories.

    1. Bare Repository(Central Repo)- They only store and share.

    2. Non-Bare Repository(Local Repo)- They can store, share and modify too.

      So that's it for this blog. I have been doing college plus DevOps (docker right now) so I am getting a very little time to blog that's I have to keep it short. In next blog I'll tell you all about some other concepts of Git.

      Thank You!