A version control system(VCS) is a tool or software that helps to manage different versions of the source code. A source code manager is another name for a version control system.
In other words Version control is a system that carries all the records of file changes or sets of files with respect to time so that we can easily switch to previous versions later.
What is Git?
Git is a type of version control system (VCS) that helps to track the file changes in an easy manner. Git is a free and open-source distributed version control system that has a simple UI design that everyone can understand easily. With the help of Git, we can track small to very large projects with speed and efficiency.
- A repository is a Collection of the Source code or files of the project work, Repositories can exist either in the local environment or in the form of a remote copy on another computer. A repository is made up of commits.
- Working Directory is the source code or files that you see in your computer's file system. When you open your project files upon a code editor, you're working with files in the Working Directory.
- Staging Area: A Stage all Changes in the Current directory that stores information about Changes that you commit. You can think of the staging area as a prep table where Git will take the next commit.
- Branch is a new line of development is created that diverges from the main line of development. This alternative line of development can continue without altering the main line.
How To Setup Git?
To download Git
- Go to Git-scm.com
- Download Git Acc. to the Operating system
- install Git choosing all of the default option
Open GitBash
First Time Git Configuration
# sets up Git with your name
git config --global user.name "<Your-Full-Name>"
# sets up Git with your email
git config --global user.email "<your-email-address>"
Create a new project.Open git bash in project directory then initialize project
git init
The git init command creates a new Git repository or initialize a new, empty repository.
- touch - used to Create a new file
- ls - used to list files and directories
- mkdir - used to create a new directory
- cd - used to change directories
- rm - used to remove files and directories
Create A Web Project
- create an index.html file
touch index.html
- create a javaScript file
touch main.html
- create a style.css file
touch style.css
git status
- git status command displays the state of the working directory and the staging area.
git add .
- git add command adds a file to the Git staging area.
git commit - m "initial commit"
- git commit -m Used to Save Your changes in local repository.
Top comments (6)
Great post nicely explained the basics π₯°.
Thankyou!! Buddy
Quite informative!!!
I'm Glad to hear thisπ
Nice Explanation :)
Thankyou!! Brother