Shows installed Git version.
git --versionSets your global Git username.
git config --global user.name "Sabir"Sets your Git email address.
git config --global user.email "[email protected]"Displays current Git configuration.
git config --listInitializes a new Git repository in the current directory.
git initCreates a hidden .git/ folder that stores repository metadata.
Shows the state of working directory and staging area.
git statusStages a file for the next commit.
git add git-commands.mdStages all modified files.
git add .Creates a snapshot of staged changes.
git commit -m "Initial Git command reference"Shows unstaged changes.
git diffShows staged changes before commit.
git diff --stagedShows commit history.
git logCompact commit history view.
git log --onelineRemoves file from repository.
git rm oldfile.txtRenames or moves a file.
git mv old.txt new.txt- Commit often, but meaningfully.
- One logical change per commit.
- Write descriptive commit messages.
- Always check
git statusbefore committing.
Working Directory → Staging Area → Repository
- Modify files
- Stage changes (
git add) - Commit snapshot (
git commit) - View history (
git log)