Git is a version control system that allows you to track changes to your code over time, collaborate with others on a project, and revert to previous versions if necessary. Here is a cheat sheet to help you get started with Git:
Git Basics
git init
Initialize a new Git repository in your current directory.
git clone
Clone an existing Git repository to your local machine.
git status
Check the current status of your Git repository.
git add
Add files to the staging area to be committed.
git commit
Commit changes to the repository with a message describing the changes.
git push
Push committed changes to a remote repository.
git pull
Pull changes from a remote repository.
Branching and Merging
git branch
List all branches in the repository.
git branch [branch-name]
Create a new branch with the specified name.
git checkout
Switch to a different branch or commit.
git merge
Merge changes from one branch into another.
git rebase
Reapply commits on top of another base tip.
Undoing Changes
git reset
Unstage changes in the staging area.
git revert
Create a new commit that undoes the changes made in a previous commit.
git checkout
Discard changes made to a file since the last commit.
Working with Remotes
git remote
List all remote repositories associated with the current repository.
git remote add [remote-name] [remote-url]
Add a new remote repository.
git fetch
Download changes from a remote repository.
git merge [remote-name]/[branch-name]
Merge changes from a remote branch.
git push [remote-name] [branch-name]
Push changes to a remote repository.
Tagging
git tag
List all tags in the repository.
git tag [tag-name]
Create a new tag at the current commit.
git push --tags
Push all tags to the remote repository.
Git Configuration
git config --global user.name [name]
Set the name associated with your Git commits.
git config --global user.email [email]
Set the email address associated with your Git commits.
git config --global color.ui auto
Enable Git to use colored output in the terminal.
These commands should give you a good starting point to work with Git. However, Git has many more commands and options that you can explore as you become more familiar with the tool. The Git documentation is an excellent resource for learning more about Git commands and how to use them effectively.