Basic Git Commands
git cheatseat

To get started with Git, First download Git for Windows/MacOS/Linux from the official website https://git-scm.com/downloads and after installing it.
create a folder on Desktop and right-click on the folder choose the option "git bash here" & start with initializing the empty repository using the git init command. To open VScode write code . and create any type of file like HTML, CSS, javascript, python etc, and follow the below commands to push the code to GitHub.
🏁 Basic Git Commands
Initialize a Git repository in your project folder:
git initAdd all the files to the staging area:
git add -ACommit the changes with a message:
git commit -m "Initial commit"Check the status of your repository:
git statusView the commit history:
git log
🔍 Viewing Changes
See the changes made to the files:
git diffSee the changes between a specific commit and the current state:
git diff <commit>See the changes between two commits:
git diff <commit1>..<commit2>See the changes in a specific file:
git diff <file>
🌳 Branching and Merging
Create a new branch:
git branch <branch-name>Switch to a branch:
git checkout <branch-name>Create a new branch and switch to it:
git checkout -b <branch-name>Merge a branch into the current branch:
git merge <branch-name>Delete a branch:
git branch -d <branch-name>
🔄 Undoing Changes
Discard changes in the working directory:
git checkout -- <file>Unstage a file:
git reset HEAD <file>Undo the last commit:
git reset HEAD~1Undo the last commit and keep changes:
git reset --soft HEAD~1Undo the last commit and discard changes:
git reset --hard HEAD~1
💾 Working with Remote Repositories
Clone a remote repository:
git clone <repository-url>Add a remote repository:
git remote add <name> <repository-url>Push changes to a remote repository:
git push <remote> <branch>Pull changes from a remote repository:
git pull <remote> <branch>Fetch changes from a remote repository:
git fetch <remote>
📂 Stashing Changes
Stash changes:
git stashList stashes:
git stash listApply a stash:
git stash apply <stash>Delete a stash:
git stash drop <stash>
That's a comprehensive list of Git commands from basic to advanced.

