Git
Useful Git Commands
Repositories
Create a New Repo
git init
git add -A
git commit -m "first commit"
git branch -M main
git remote add origin <REPO_LINK>
git push -u origin mainPush an Existing Repo
git remote add origin <REPO_LINK>
git branch -M main
git push -u origin mainBranches
Create a Branch
Switch a Branch
Push to Branch
Delete a Branch
Rename a Local Branch
Unstage All Changes on Local Branch
Unstage a File on Local Branch
Divergent Branches
Merge Main to Local Branch
Commits
Revert to Previous Commit
Revert all Unstaged Changes
Amend Last Commit
Restore File to a Specific Commit
Accounts
Display Username and Email in Current Repo
Change Username and Email in Current Repo
Change Username and Email Globally
Last updated