git config --global user.name "Your Name"
git config --global user.email "123456789+yourname@example.com"
git config --list
cd /path/to/your/project
rm -r .git
git init // all files in working directory
git remote add origin https://github.com/your-username/your-repo.git
git remote -v
git remote set-url origin https://github.com/your-username/your-repo.git
git remote -v
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
Settings > Developer Settings > All repositories
https://docs.github.com/en/get-started/git-basics/managing-remote-repositories#switching-remote-urls-from-ssh-to-https
git branch -M master # Rename current branch to 'main'
git push -u origin master # Push local code and set upstream to 'main'
Username for 'https://github.com':
Password for 'https://OWNER@github.com':
branch 'main' set up to track 'origin/main'.
Everything up-to-date
git add . // add all files in working directory
git commit -m "Your awesome message"
git status
git push origin master
git reset --soft HEAD~1 // cancel 1 last commit
git reset HEAD . // cancel all commits
git reset --hard // deletes files in project folder
git clean -fd
git rm -r --cached .
git status
On branch master
nothing to commit, working tree clean
git rebase --abort
git remote -v
git checkout -b currentbranchname // exit current branch
Already on 'a'
git checkout -b anotherbranchname // switch to another branch
Switched to branch 'b'
git push origin branchname
git push -u -f origin branchname
-u switch makes the remote GitHub repo the default for your existing project
-f switch forces Git to overwrite any files that already exist on GitHub
error: Your local changes to the following files would be overwritten by checkout:
git checkout -f branchname
git config -l
git config --edit
git config --global --edit
git init -b branch-name
git repo create project-name
git pull --set-upstream origin branch-name
git add . && git commit -m "initial commit" && git push
git push --force origin HEAD: branch-name