Skip to content

Instantly share code, notes, and snippets.

@ben-eddy74
Last active May 22, 2023 10:55
Show Gist options
  • Save ben-eddy74/2312ebabc53089362fbb8b608ed5ee3b to your computer and use it in GitHub Desktop.
Save ben-eddy74/2312ebabc53089362fbb8b608ed5ee3b to your computer and use it in GitHub Desktop.
GitHub cheatsheet

GitHub cheatsheet

Set local git identity

git config --global user.email "evermoen@gmail.com"
git config --global user.name "Eddy Vermoen"

Push existing local project to new GitHub project

  1. On GitHub, create a new repository
  2. In local project folder, execute:
git init
git add --all
git commit -a -m "First commit"
git remote add origin https://github.com/ben-eddy74/new-project
git branch --set-upstream-to=origin/main main
git pull --allow-unrelated-histories
git push -u origin main
  • In case a merge conflict occurs, open the folder with VSCode and resolve the conflict
  • In case the current branch is behind, add -f to the git push command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment