Git Cheat Sheet
Here is an extensive cheat sheet for using Git:
Basic Commands
Initializing a Repository
Initialize a new Git repository.
Cloning a Repository
Clone an existing repository.
Checking the Status
Show the working directory status.
Adding Changes
Add a file or all changes to the staging area.
Committing Changes
Commit staged changes with a message.
Viewing the Commit History
Show the commit history.
Branching and Merging
Creating a New Branch
Create a new branch.
Switching Branches
Switch to a different branch.
Merging Branches
Merge a branch into the current branch.
Deleting a Branch
Delete a branch.
Remote Repositories
Adding a Remote
Add a new remote repository.
Fetching Changes
Fetch changes from a remote repository.
Pulling Changes
Fetch and merge changes from a remote branch.
Pushing Changes
Push changes to a remote branch.
Undoing Changes
Resetting Changes
Reset changes at different levels.
Restoring Files
Restore files to the last committed state or unstage them.
Reverting Commits
Create a new commit that undoes a previous commit.
Stashing
Stashing Changes
Stash changes in the working directory.
Applying Stashed Changes
Apply stashed changes.
Listing Stashes
List all stashes.
Submodules
Adding a Submodule
Add a new submodule.
Updating Submodules
Initialize and update submodules.
Running Commands in Submodules
Run a command in each submodule.
Tags
Creating a Tag
Create an annotated tag.
Listing Tags
List all tags.
Pushing Tags
Push a tag to a remote repository.
Worktrees
Creating a Worktree
Create a new worktree for a branch.
Listing Worktrees
List all worktrees.
Removing a Worktree
Remove a worktree.
Advanced Index Manipulation
Adding to the Index
Add a file to the index.
Marking as Assumed Unchanged
Mark a file as "assume unchanged".
This cheat sheet covers a wide range of Git commands and their usage. It can serve as a quick reference guide for beginners and experienced users alike.