-
-
Save itsmattsoria/6371614 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enough Git for your résumé in fewer than 100 lines | |
================================================== | |
1. Install Git | |
http://git-scm.com/download/mac | |
(But consider using Homebrew) | |
2. Make a GitHub account | |
https://github.com/ | |
3. Open Terminal | |
/Applications/Utilities/Terminal.app | |
Configure | |
========= | |
git config --global user.name "Your Name Here" | |
git config --global user.email "[email protected]" | |
Start a project | |
=============== | |
mkdir -p ~/Desktop/totes-awesome-project/ | |
cd ~/Desktop/totes-awesome-project/ | |
git init | |
echo "# Totes Awesome Project" > README.md | |
git add . # Shortcut for adding all, which is just README.md | |
git commit -m "My first commit. So precious." | |
git remote add origin [email protected]:yourusername/Totes-Awesome-Project.git | |
# Create the new repository at https://github.com/new as "Totes Awesome Project" | |
git push -u origin master | |
# Go to https://github.com/yourusername/Totes-Awesome-Project | |
Work on a new feature | |
===================== | |
git checkout -b this-is-my-new-feature-branch # -b is shortcut for creating and switching to new branch | |
mate . # Textmate specific, so just work on something | |
git status | |
git add html9-boilerplate-framework-omg.css | |
git rm worthless.html | |
git commit -m "First edit for the feature" | |
# Work some more | |
git add whatever.min.js | |
git diff --staged | |
git commit -m "Second edit for the feature" | |
# You could push this-is-my-new-feature-branch out to remote if collaborating with others | |
# git push origin this-is-my-new-feature-branch | |
Update with new feature | |
======================= | |
git checkout master | |
git merge this-is-my-new-feature-branch | |
git push origin master | |
# Go to https://github.com/yourusername/Totes-Awesome-Project, get giddy | |
Delete new feature branch | |
========================= | |
git checkout master | |
git branch -d this-is-my-new-feature-branch | |
Stay updated with others | |
======================== | |
cd totes-awesome-project | |
git pull origin master | |
git diff HEAD | |
Confused? | |
========= | |
git status # Show untracked/tracked files | |
git branch # Show branches and which one you're on | |
git log # Show the commits, or git log --graph for pretty | |
git show thelonggitlognumber1234567890 # Show old versions of files | |
git diff thelonggitlognumber1234567890 # Show diffs between file versions | |
Fork someone's work | |
=================== | |
# Go to GitHub project, click Fork | |
git clone https://github.com/yourusername/cool-forked-project.git | |
cd cool-forked-project | |
git remote add upstream https://github.com/theotherguy/cool-forked-project.git | |
git fetch upstream | |
Benefits of Git: | |
- You have a local copy of the repository, which complements local development with `rails s`/`python manage.py runserver` | |
- Branching for new features is easier than SVN | |
- Faster/smaller in size than SVN | |
- Just remember to visualize the local/remote + branch/master way of thinking | |
Good links: | |
https://help.github.com/articles/create-a-repo | |
http://rogerdudler.github.com/git-guide/ | |
http://hoth.entp.com/output/git_for_designers.html | |
http://gitimmersion.com/ | |
http://csswizardry.com/2012/12/my-git-workflow-for-inuit-css/ | |
http://mac.github.com/ | |
http://git-scm.com/doc | |
https://delicious.com/richiesee/git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment