GitHub Cloud Basics
While Git is the time-machine tool that runs locally on your computer, GitHub is a website on the internet that acts as a cloud hosting home for those saves. It adds a visual interface and social features to help teams work together.
Creating a Brand New Repository (Repo)
A Repository (or "Repo" for short) is simply your project's digital folder in the cloud.
Step-by-Step: Creating a Repo on GitHub
- Log into your GitHub account and click the "+" icon in the top-right corner, then select New repository.
- Repository name: Pick a short, memorable name (e.g.,
my-first-app). - Public vs. Private:
- Public: Anyone on the internet can see your code (great for portfolios).
- Private: Only you and people you explicitly invite can see it.
- Initialize options (Best left unchecked if you already have local code):
- README file: A text file explaining what your project does.
- .gitignore: A checklist telling Git which files to ignore (like private passwords or messy system files).
- Click Create repository.
Connecting Your Computer to GitHub
Once your cloud repository is created, GitHub will show you a page with a unique web URL (ending in .git). You use this link to bridge your computer and the cloud.
- If starting fresh on your computer: Use the URL with
git clone <URL>to download the empty folder. - If you already have code on your computer: Use the commands provided on GitHub's landing page to link your local project to this remote URL and push your work up for the first time.
Pull Requests (PRs)
A Pull Request is a message you send to your team saying: "Hey, I finished fixing this bug on my branch. Please review my code changes, and if they look good, pull them into the main project!"
How to open a Pull Request:
- Push your side branch up to GitHub.
- Go to the project page on the GitHub website. You will see a yellow bar pop up saying "Compare & pull request". Click it.
- Write a clear title and description explaining what your code changes do.
- Click Create pull request.
- Your teammates can now leave comments on specific lines of your code, suggest edits, and finally click Merge to combine your work into the
maintimeline.
Issues (The Project To-Do List)
GitHub Issues act as a giant, shared to-do list for a software project.
- Anyone can open an Issue to report a bug, suggest a new feature idea, or ask a question.
- Project managers can assign specific issues to developers, add color-coded labels (like
bug,documentation, orgood first issue), and track what tasks need to be completed next.
Forking (Copying Someone Else's Project)
If you find an open-source project on GitHub that you love and want to experiment with, you won't have permission to modify their official code directly. Instead, you use a Fork.
- Clicking the Fork button in the top-right corner of any GitHub repository creates an exact, independent copy of that entire project inside your own personal GitHub account.
- You can safely change anything you want inside your fork.
- If you build a really cool feature inside your fork and want to share it with the original creators, you can open a Pull Request from your fork back to their official repository!