What is GitHub?
GitHub is a web-based Git repository hosting service owned by Microsoft. It’s built for version control and collaboration, providing a platform for developers to manage Git projects, share code, and collaborate with others.
Key Features of GitHub
- Repositories: Centralized places where code, documentation, and version history are stored. Each project lives in its own repository (repo).
- Branches: Create branches for working on features or fixes separately from the main codebase.
- Pull Requests (PRs): Propose, review, and discuss changes in code. PRs are central to the GitHub workflow.
- Issues: Track bugs, enhancements, and tasks within a repository.
- Actions: GitHub’s CI/CD tool for automating workflows, such as running tests, building projects, or deploying applications.
- GitHub Pages: Host websites directly from a repository.
- Forking: Create a personal copy of someone else’s repository to make changes independently.
Basic GitHub Workflow
- Fork: Make a copy of the repository to your GitHub account.
- Clone: Download the repository to your local machine with
git clone [URL]
. - Create a Branch:
git checkout -b [branch-name]
to work on a new feature or fix. - Commit Changes: Make edits, then
git add .
andgit commit -m "description"
. - Push Changes: Send your commits to GitHub with
git push origin [branch-name]
. - Create a Pull Request: Go to the GitHub repository and open a pull request (PR) from your branch to the main branch.
- Review & Merge: After approval, merge your PR to the main branch.