Git is a system for keeping track of changes in code. It’s particularly useful for collaboration (“Hello, world of fellow programmers!”) and reversion when a project’s source code has inadvertently ventured treacherously and irrevocably astray (fervently spamming CMD+Z is not always enough to re-establish baseline).
I obdurately refused to learn git for many years, because I am a doofus, and worked mostly solo on projects (verily to detriment). I recommend learning git, sharing code, and collaborating with others. Feedback is invaluable; you’ll get way better way faster than I did working this way.
Because I didn’t exactly hit the ground running, in terms of adapting git, I’ve typed out loose directions for personal reference—and for others whose interest is piqued and could use a guiding hand.
- Install Xcode command line tools:
open new Terminal tab/window
xcode-select --reset) (see: link)
- Go through seemingly pertinent GitHub setup guides: link
- Generate SSH key (and add passphrase to keychain): link
- Add SSH key to GitHub account: link
- Visit: link
- Choose repository name and public/private (skip other options)
- Create repository
- Leave succeeding page open (it lists helpful commands and SSH URL needed below)
- Navigate to local, top-level project directory (e.g., WordPress theme or root):
open new Terminal window/tab
cd [Local Path](drag folder from Finder to Terminal to get path)
- Initialize as remote repository and add origin:
git remote add origin firstname.lastname@example.org:[GitHub Username]/[Repository Name].git
.gitignorefile to ignore files in remote repository:
edit w/ text editor (see: link for guidance w/ file contents)
- Add remote files and commit changes:
git add -A
git commit -am "[Message]"(e.g.,
git commit -am "first commit")
- Push remote to origin:
git push -u origin master
- View status:
- Remove .DS_Store:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch(see: link)
git add -A
git commit -am "delete .DS_Store"
- Remove remote repository:
rm -rf .git