![](https://codelido.com/assets/files/2022-12-30/1672387820-790227-image.png)
Git is a distributed version control system.It is used in tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
How git works:
Every developer has an entire copy of the code on their local systems. When they push the copy to cloud Any changes made to the source code can be tracked by others. Hence there can be regular communication between the developers.
->To push the local copy to cloud we can use github, gitlab etc
Working with git:
1) install git in respective operating system.
2) check the version in command prompt by using the code git –version.
3) create an account in github
some of the git commands:
git init: is used to create an empty Git repository.
git init
git status: The git status command tells the current state of the repository.
git status
git add: It is used to add any new or modified files.
git add <file_name>
git commit: The commit command makes sure that the changes are saved to the local repository.
git commit –m <message>
git clone: The git clone command is used to create a local working copy of an existing remote repository.
git clone <remote_URL>
git push: The command git push is used to transfer the commits or pushing the content from the local repository to the remote repository.
git push -u origin master
git config: The git config command is used initially to configure the user.name and user.email. This specifies what email id and username will be used from a local repository.
git config –global user.name “any user name”
git config –global user.email <email id>
git pull: The git pull command is used to fetch and merge changes from the remote repository to the local repository.
git pull <branch_name> <remote URL>