Creating an Index.html File using GIT.
Version control is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.
It helps teams solve these kinds of problems, tracking every individual change by each contributor and helping prevent concurrent work from conflicting.
Using Git by adding a simple HTML file to working tree.
Step 1: Installing git on your Local Computer.
— https://git-scm.com/downloads
Step 2: Configure Git
Either on your computer Command prompt or Cloud Shell
To configure Git, we need to define some global variables: user.name
and user.email
.
Both are required to make commits using:
— git config — global user.name “<USER_NAME>”
— git config — global user.email “<USER_EMAIL>”
— run git status
to check that your changes worked.
Step 3: Setting up my Git repository
— creating an empty folder for the project, and then initialize a Git repository inside it using this below command.
— git init
— git checkout -b main
— Use an ls -a
command to show the contents of the working tree to confirm that the directory contains a subdirectory named .git.
Git commands:
git status
displays the state of the working tree
git log
used to see information about previous commits.
git add
used to keep track of changes.
git commit
used to update changes.
Step 4: Creating and adding(staging) a file
— Using the repository created in step 3, still in the same folder created.
touch
index.html
— Using git add .
to add new file .
— use git status
again to make sure the changes were staged properly.
Step 5: Making my first commit
— git commit index.html -m “
Create an empty index.html file”
— git status
following up to confirm that the working tree is clean.