Table of contents
No headings in the article.
Git is a free, open source version control tool. It's designed to keep track of the changes made over time on a particular project, it allows us to go back to the previous version at any point of time. While developing newer features or upgrading the older feature with more functionality, we might end up making mistake that can cause trouble, to tackle this we use git version control system using which we can rolls back to previous version. Git make collaboration easy.
Git is one of the most important skill to know for any developer nowadays.
Following are the some commands that're must to be known -
1. Config
Using this command we can set up the username and email on a global as well as on local level.
git config -global user.name "name"
git config -global user.email "email"
2. init
This command is used to create a new repository for project or to initialize the existing project
git init repository_name
3. Clone
This command is used to clone the remote repository into the local machine.
git clone URL
4. Add
This command is used to get the file into staging area.
// to add a particular file
git add filename
// to add all the file
git add -a
5. commit
This command is used to commit the files with a message in the staging area. It is a short message that tell what changes are made.
git commit -m "Your Commit Message"
6. fetch
It allows a user to get the changes made on the repository remotely on the local machine.
git fetch
7. checkout
This command is used to switch between branches or create new branches.
// switch to different branch
git checkout branchName
//create new branch
git checkout -b branchName
8. push
This command is used to push local changes that have been commited to the remote repository.
git push
9. branch
This command used to display all the branches or delete a particular branch.
// display branches
git branch
// create new branch same as checkout
git branch branchName
// delete branch
git branch -d branchName
10. status
This command will show you the current status of your repository, the changes you made, staged, unstaged, untracked, commited, modified or deleted files.
git status