Git is a Source Code Management Tool.
It is a free and open-source version control system.
Git helps to keep track of different versions of a single code base by tracking all changes.
Git is Distributed Version Control System(DVCS).
Stages in git
- Workspace/Working directory
- Staging area
- Local Repository
Workspace:- it is your working directory
It stores changes in repository
It uses SHA-1 checksum concept
If you change anything in code then commit id will be changed
You can easily track changes through commit id
Tags in git
Tag assigns a meaningful name with a specific version in repository, like we let some change in code and assign tag with commit id to identify its easily.
When we done with our code and went to add the code in remote repository, then we will use the push command to transfer the code from local repository to remote repository.
Pull command copy the code from remote repository to local repository
Branch in Git
Branch is a place where your code is placed, it may be master or main branch.
Each task has one separate branch.
Branch merge means if someone working some other code and you went to add their code in your branch/code then merge command will be use.
When same file having different content in different branches, git conflict occurs when you merge them in single branch.
Git stashing is a temporary storage for your code, it mean if your are working on new project and someone told you to work on old project, in this case you can store your new project in stashing area for few hours.
It is powerful command that is used to reset local changes to the state of git repository. We will use this command when we want to discard the changes, it will revert the commit id to previous commit id.
The revert command helps you to create new commit and it will create new commit which is opposite to existing commit without deleting data.