Sure, here's a basic Git cheat sheet in Markdown format for beginners:
Configure Git with your name and email:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"If you're using Mac then you might want to store your git credentials using osxkeychain.
git config --global credential.helper osxkeychainInitialize a new Git repository:
git initClone an existing repository:
git clone <repository-url>Check the status of your working directory:
git statusAdd changes to the staging area:
git add <file-name>Commit changes to the repository:
git commit -m "Your commit message here"Remove changes from staging area
git restore --staged <file-name>List all branches:
git branchCreate a new branch:
git branch <branch-name>Switch to a branch:
git checkout <branch-name>Create and switch to a new branch:
git checkout -b <branch-name>Merge changes from one branch into the current branch:
git merge <branch-name>Delete a branch:
git branch -d <branch-name>Add a remote repository:
git remote add <remote-name> <repository-url>List all remotes:
git remote -vPush changes to a remote repository:
git push <remote-name> <branch-name>Pull changes from a remote repository:
git pull <remote-name> <branch-name>View commit history:
git logView changes for a specific file:
git log -p <file-name>Discard changes in the working directory:
git checkout -- <file-name>Unstage changes from the staging area:
git reset HEAD <file-name>Amend the last commit:
git commit --amendShow the differences between commits, branches, or files:
git diffIgnore files with a .gitignore file:
Create a file named .gitignore and list the files/directories you want to ignore.