Initialization and Configuration
Command | Description |
---|---|
git init | Create a new repository in the current directory. |
git config | Set Git configuration options, like user name and email. |
File and Directory Management
Command | Description |
---|---|
git ignore | Manage files and directories to be ignored by the repository. |
git rm | Remove files from the repository and staging area. |
git mv | Move or rename files within the repository. |
git clean | Remove untracked files from the working directory to keep it clean. |
git archive | Create an archive (e.g., .zip or .tar ) from the repository content. |
Status and History Inspection
Command | Description |
---|---|
git status | Display the current status of the working directory and staging area. |
git log | Show the commit history with details like hash, author, date, and message. |
git reflog | Display the reference history, showing actions related to HEAD. |
git diff | Show differences between files or versions, such as between commits or between the working directory and staging area. |
git blame | Show who last modified each line of a file and when the changes were made. |
Submodules and Worktrees Management
Command | Description |
---|---|
git submodule | Manage submodules, which are external repositories embedded in the main repository. |
git worktree | Manage multiple working directories within the same repository. |
Cleanup and Optimization
Command | Description |
---|---|
git prune | Remove unreachable objects from the repository. |
git clean | Remove untracked files from the working directory to keep it clean. |
Debugging and Searching
Command | Description |
---|---|
git bisect | Use binary search to find the commit that introduced a bug. |
git grep | Search for patterns within files in the repository. |