Overview.
Version Control System (VCS) is a software that helps software developers to work together and maintain a complete history of their work. Git is a version control system that helps programmers and developers manage and track changes to their code at any time. It allows multiple developers to work on a project simultaneously, maintain a history of changes, and revert to previous versions if needed.
In this article, we’ll explore a list of essential Git commands, such as git push
, git commit
, git pull
, and others, that can enhance your workflow and boost productivity.
Git Installation:
Use the following command to install git.
sudo apt install git
git --version
Git Config:
To set the basic configurations on Git like your name and email.
The git config --list
command is used to display all the configuration settings Git is currently using.
git config --global user.name "your name"
git config --global user.email "your email"
git config --list
Git init:
create a local git repository for us in our store folder. This will help to manage the git commands for that particular repository. This is a initialized empty git repository.
Git status:
The git status
command is used to display the current state of your Git repository. It shows information about changes in your working directory and staging area, helping you keep track of what needs to be committed, staged, or ignored.
This files are untracked files.
Git clone:
The git clone
command is used to create a local copy of a remote Git repository. This command downloads the entire repository, including its history, branches, and files, to your local system.
Copy your repository url in your github.
git clone <your repository url>
My-register-app is my repo. Go to repo use cd <repo name>/ command and listout my files use ls command.
cd my-register-app/
ls
Git add:
Add a specific list of files to the staging area.
git add .
Add all files of the current directory to the staging area.
git add --all
Git log:
The git log
command is used to display the commit history of a Git repository. It shows details about each commit, such as the commit hash, author, date, and message. This is essential for understanding the changes made over time in a project.
Create a new branch:
The git branch
command is used to manage branches in a Git repository. Branches are essential for creating separate lines of development, enabling multiple developers to work on different features or fixes simultaneously.
git branch <branch name>
See all the branches present and current branches that we are working on.
git branch
Git checkout:
Switch to branch Testing from the master branch.
git checkout <branch name>
See hidden directories and files within the current directory.
ls -a
Create New Repo:
The mkdir
command is used to create new directories (folders) in a file system.
mkdir <newreponame>
Create a File:
The touch
command is primarily used to create empty files.
toch <file name>
Conclusion.
Git is a powerful tool for version control and collaboration. By mastering its basic commands, such as git clone
, git commit
, and git push
, you can efficiently manage your projects and contribute to team workflows. Start practicing today to build your expertise!
Add a Comment