Git is version control system for tracking changes in computer files and coordinating work on those files among multiple people. It is primarly used for source-code management in software development, but it can be used to keep track of changes in any set of files.
Git LifeCycle:
1. Working Directory -
- The place where your project resides in your local disk.
- This project may or may not be tracked by git.
- In either case, the directory is called the working directory.
- The project can be tracked by git, by using the command git unit.
- By doing git init, it automatically creates a hidden .git folder.
2. Staging Area.
- Once we are in the working directory, we have to specify which files are to be tracked by git.
- We do not specify all files to be tracked in git, because some files could be temporary data which is being generated while execution.
- To add files in the staging area, we use the command git add.
3. Commit.
- Once the files are selected and are ready in the staging area, they can now be saved in repository.
- Saving a file in the repository of git is known as doing a commit.
- When we commit a repository in git, the commit is identified by a commit id.
- The command for initializing this process is git commit-m "message"