GIT
GIT is a version control system that is designed to handle small to large projects with speed and efficiency. It allows multiple people to work on same project simultaneously without effecting other's code.
GIT is most common skill that recruiters expect in everyone's resume. There are some of the basic commands that must be known to everyone while working with git or attending any technical interview.
MUST KNOW GIT COMMANDS
These commands are used to setup git in your system. Using the commands below one can access the git synchronized with the mail ID.
git config --global user.name "Your name"
git config --global user.email "Your mail"
This command is used initialize a repository in your git. Once the repository is initialized other actions like commit, push or pull can be performed over these repository.
git init
Below command is used to clone an existing repository into your repository.
git clone <repository_url>
The command below is used to get the status of repository.
git status
Stage the changes for commit.
git add <file_name>
# Command stages the changes in that particular file
git add .
#Command stages the entire changes.
Commit changes to the repository
git commit -m "Your message"
View the history of commits in the repositiory
git log
Creating a new branch.
git branch <branch_name>
Switch to a new branch
git checkout <branch_name>
Create and switch to a new branch
git checkout -b <branch_name>
Merge a branch to the new branch
git merge <branch_name>
Know which branch you are working in.
git branch
Add a repository to the remote repositiory
git remote add origin <repository_url>
Fetch changes from the remote repository
git fetch
Push changes to the remote repositiory
git push origin <branch_name>
Pull changes from the remote repository
git pull
List remote repositories
git remote -v
Stash the changes when your are not ready to commit them.
git stash
Apply the stashes to the desired branch
git stash apply
Top comments (1)
Great post, Shreeprabha! This is a concise and helpful guide for beginners to get started with Git. It covers all the essential commands needed for basic version control tasks. Looking forward to more of your content!