What is Git Repository?
A Git "Repo" is a workspace which tracks and manages files within a folder. Anytime we want to use Git with a project, app, etc we need to create a new git repository. We can have as many repos on our machine as needed, all with separate histories and contents
Our first Git Command
$ git status
git status gives information on the current status of a git repository and it's content. If the output of this command gives fatal error as below, which means that git is currently not initialised in this directory.
fatal: not a git repository (or any of the parent directories): .git
Our first Actual Git Command
$ git init
Before we can do anything git-related, we must initialize a repository first!. Use git init to create a new git repository. This is something we do once per project. Initialize the repo in the top-level folder containing the project.
Git Adding
$ git add "file1.extension" "file2.extension" => to add specific file like(file1 and file2) to staging area.
$ git add . => it will stage all changes at once.
We use the git add command to stage changes to be committed. It's a way of telling Git, "please include this change in our next commit"
Git Committing
$ git commit -m "your message"
Making a commit is similar to making a save in a file. We're taking a snapshot of a git repository in time. When saving a file, we are saving the state of a single file. With Git, we can save the state of multiple files and folders together.
We use the git commit command to actually commit changes from the staging area. When making a commit, we need to provide a commit message that summarizes the changes and work snapshotted in the commit. The -m flag allows us to pass in an inline commit message