Git-Version control goes through the abovementioned steps: untracked, unmodified, modified, and staged. Below is the full process(lifecycle) of Git:-
Untracked: This is a simple state of the very first stage where files are not added to Git. Even Git is not initialized till now.
Unmodified: This is the state after Git is initialized, but not any changes to the file.
Modified: This is the state after initialization and then if any changes have been done to the file it is a modified shape.
Staged: This is state done in Git i.e. telling git to add changes to the file to the staging area. The area from where we can revert or fix it to commit state. Here, you can add files i.e. staging multiple times of file is possible.
Then, the most important part is done, i.e. committing changes, which means declaring that you have changed the much you want and saving this change with the message, timestamp and more. The whole loop goes through and through. If ".git" is removed or the file is deleted then it reverts back to the untracked state.
Git Configuration:
A git configuration is done generally once only. Git config is used for configurating git for the first time.
Common use case is to add contact email and the username. Git configuration is
generally one time use case only. Git get and set configuration variables that
controls all facets of how Git looks and operates.
setting git user name
git config --global user.name “User Name”
Here –global defines that the changes are on global level. That
means it will be applied for each commits.
setting git user mail
git config --global user.email "info@mail.com"
This code means setting email for all comits and changes done by you. General practice is to keep your contact email and email used to open github account.
view git configuration
git config -list
This code means displaying all configuration implemented in here.
Now that git has been configured you can now proceed to initializing git. Git is initialized for starting tracking of git. This creates ".git" file to start tracking git version control. If .git is removed all commits and changes of version are deleted.
initialization git
git init
init means initialization, this creates .git file that stores snapshots of different versions i.e. commits.
only after initialization can we implement commits, staging as shown in above figure.