GIT GOOD: How To Turn Your Local Folder Into A Repository On GitHub

Did you, while saving a file with the name “draftx_version4_edit12.py,” recall a whisper on the wind of the words “version control”? Did you save that filename and then Google “version control,” immediately becoming overwhelmed with confusing lingo and tools? Did you close that browser window and vow never to think about “git” or “repos” or “commits” again?

Great news! You don’t necessarily need to understand all the lingo to get started in foolproof, risk-free version control. Below are steps that I use to get a folder on my computer set up as a repository on Github. From there, I can “commit” and “push” new changes to files whilst Github keeps track of every version. No “paper1_finaldraft_edit3.docx” filenames again!

This is a BRIEF, barebones guide to starting a Git repository from the command line. I am in NO WAY an expert – these are just the simple steps that work for me. For a more detailed account of all these steps and terms, check out a fantastic getting started with Git tutorial here. Another simple guide to using Git on the command line is here.

With just an hour or two of research and practice, you can save yourself from a lifetime of absurd filenames!

git good

GIT GOOD
pamop.com

  • Use Mac native Git or install from online git download
  • Make GitHub account
  • Open Terminal/Command Line
    • Enter the following lines one-by-one using your own name, GitHub email, and name of the folder on your computer you want to Git-ify:
      git config --global user.name "Your Name"
      git config --global user.email "YourEmail@whatever.com"
      cd Documents/YourFolderName
      git init
  • Go to github.com
    • Make a new repository titled the same as the folder you want to Git-ify (e.g., YourFolderName)
  • Back to terminal
    • Enter the following one-line command with your GitHub username and folder name:
      git remote add origin https://github.com/YourUsername/YourFolderName.git
    • Now add your first commit!
      • If there are already files in your local folder:
        git add .
      • Or you can create a text file to practice (for example, a readme):
        touch Readme.txt
        git add Readme.txt
      • Commit and push to GitHub:
        git commit -m "My first commit!"
        git push
  • If at any point you mess something up:
    • Enter the following command in terminal to remove git from your folder:
      rm -rf .git
    • Start over again with the “git init” command

Voila!

Let me know if I made any mistakes or if you have an even briefer, easier guide I can link here. I may be a Git newbie, but I won’t let that stop me from reaping version control benefits.

Leave a Reply