GIT Version Control System

This article teaches you what is working directory and how to commit.

Saroth 2 min read
GIT Version Control System

This article teaches you what is working directory and how to commit.

J. GIT Components

The 4 main components of GIT.

  • Working Directory

  • Staging Area

  • Committed History

  • Development Branches

First of all, let’s see the working Directory.

1. Create a project directory git-learning using cmd, git bash or terminal.

mkdir git-learning

2. Go to the git-learning directory.

cd git-learning

3. Create a file index.html in git-learning.

touch index.html

4. See what are the files in git-learning

ls

GIT Version Control System

5. Open the folder in VS Code, if we need to control our project folder using git

git init

Note: This command changes the current directory to the git repository. If we are not in the git-learning project folder, first go to the git-learning project folder. After init the project.

cd git-learning
git init

GIT Version Control System

6. Create a sample project in Vs code and check the status of the project.

GIT Version Control System

GIT Version Control System

There are some commands you can see on this git bash. Let's see them one by one.

  • On branch master: branch is master.
  • No commits yet: No actions made in a git repository.
  • Untracked files: Our creating file index.html isn’t in the git repository.

7. So, how to add those untracked files to the git repository.

git add index.html
git status

GIT Version Control System

If you add any data in your file index.html you must add a file in the git repository everytime. For an example,

Consider adding ul data in your file after adding the index.html file in the git repository.

GIT Version Control System

Now you have checked the status of your project again.

GIT Version Control System

Changes are not staged for commit. So you have to add the file again in the git repository.

GIT Version Control System

Now changes to be committed.

8. How to record or commit our data in a git repository.

git commit -m “Initial Commit”
git status

GIT Version Control System

Now no changes in the working directory and git repository.

I hope you understand what is working directory and how to commit. In later chapters, we will discuss the staging area.

0 Comments

Leave a comment

Your email address will not be published. Required fields are marked *

By posting, you agree that your name and comment are published. See our privacy policy.