I don’t use git or github enough to remember the commands and most articles skim over the actual workflow I tend to need. So here’s my cheatsheet supporting this exact flow:

  1. Clone a repo from github onto local
    • git clone {https://github.com/author/proj}
  2. Make and commit edits on local
    • git commit -m “my commit message!”
  3. Add new personal repo on github
    • Go to github click new repo, add project name, copy link {https://github.com/me/proj.git}
  4. Add remote github repo to local repo
    • git remote add {proj} {http://github.com/me/proj.git}
    • check the linked remote repos: git remote -v
    • rename remotes: git remote rename origin {somthingElse}
  5. push to remote github. (-u flag sets default remote)
    • git push -u {proj} main
    • subsequent pushes are easier now default: git push

Leave a Reply

Your email address will not be published. Required fields are marked *