Git & GitHub
Git is a version control system used on the terminal, or command line, so developers can keep track of code changes on any given project. It also allows for collaboration. Instead of having to send code back and forth, like through email or FTP, developers can pull the latest version of a project and keep track of the revisions made to the code.
GitHub is a development platform that uses git, where code for projects can be stored. Then other developers can others can easily view and access the code files. Other similar services include GitLab and BitBucket. I personally prefer GitHub because that's the platform I used to learn git. You can sign up for a free account if you don't already have one.
Documentation & Messages
When working with git and any service like GitHub be aware of ReadMe, Pull Requests, and Commit Messages.
- Readme, often seen as ReadME.md, uses markdown syntax and contains documentation about the repo. This helps other users understand your repo and your goals regarding it.
- Pull Requests are used with teams and open source communities. On GitHub you can find the Pull Request tab right under the the repo's name. Pull Requests are used to compare changes or additions to code in the repo. To open a pull request for an open source project, fork the repo, use
git cloneto clone that forked version, make a branch off of master with
git checkout branch [branch-name]. After making changes and pushing those up to your forked repo, go to the original repo, and use the Pull Request button to submit your changed code.
- Commit Messages are messages you write in the terminal once you have added files to your remote repo with
git add [file-name]. Use the command
git commit -m "put text in single or double quotes"to make a commit. This message will show up in your repo so you can keep track of code changes. To make a multi-line message, simple press enter before closing the quotes.
Local, Remote, and Origin
- Local environment refers to your personal computer
- Remote refers to an in-between state. It's where all of your file changes live when they are committed but not yet pushed
- Origin refers to GitHub's environment
Resources I've Found Helpful
How to set up a GitHub Repo
touch ReadME.md git init git add ReadME.md git commit -m "first commit" git remote add origin [github_repo_url] git push -u origin master
Add changed files
git status git add [name_of_file]
Output the branch you are on
git branch | grep \*
Output the remote
git config --get remote.origin.url
Git & GitHub Projects
Contribute to this website
You will need a basic understanding of handlebars, sass, and/or markdown. Go to this repository, or repo, on GitHub and contribute to it. Fork the repo, clone it, and add something you've learned about web development ot the bottom of the ReadME.md. Or, if there are any issues in the Issue tab, comment that you will be working on one, and start tackling the issue.
Create your own repo or contribute to Open Source
Create a repo for a project you are interested in starting, such as a personal website. Create a ReadME for the repo with some documentation, and try to make small, well documented commits. If you would rather contribute to an existing repo, check out the following links to find an Open Source project you are interested in.