My Awesome GitHub CheatSheet

Image credit: Unsplash

Onboarding an existing project to GitHub

If the project is not yet initialized by git, do the following first

git init ;
# then create a .gitignore file if needed
git add . ;
git status -u ; # will show you all the files to be committed.
git commit -m "init commit" ;

Then connect it to GitHub

git remote add origin git@github.com:davxiao/my-proj.git ;
git branch --set-upstream-to=origin/master master ;
git pull origin master --allow-unrelated-histories ;
git push ;