GitHub Overview
Introduction
Section titled “Introduction”GitHub is a cloud-based platform for version control and collaboration, built around Git, a distributed version control system. It is widely used by developers, open-source contributors, and enterprises to manage code repositories, track changes, and collaborate efficiently.
GitHub guides on this site
Section titled “GitHub guides on this site”Read in this order the first time:
- GitHub overview (this page): accounts, repositories, branches, pull requests and issues.
- How to fork a repository: contributing to projects you do not own.
- GitHub Actions and automation: workflows, secrets and variables, self-hosted runners, GitHub Packages and webhooks.
- GitHub administration guides: repository governance with rulesets, branch naming, CODEOWNERS, templates, teams and permissions.
- GitHub Copilot overview: features, surfaces and plans, followed by Copilot in VS Code and Copilot best practices. The Copilot menu lists the remaining Copilot guides.
New to Git itself? Start with Git fundamentals.
Key Features of GitHub
Section titled “Key Features of GitHub”- Version Control: Tracks changes in code over time.
- Collaboration: Enables multiple contributors to work on projects.
- Issues & Project Management: Helps teams manage tasks and track progress.
- Pull Requests & Code Reviews: Facilitates code review and merging of changes.
- CI/CD with GitHub Actions: Automates workflows for building, testing, and deploying applications.
- Security & Compliance: Offers code scanning, dependency management, and security alerts.
- Hosting & Documentation: Provides GitHub Pages for project documentation and static website hosting.
Getting Started with GitHub
Section titled “Getting Started with GitHub”1. Creating a GitHub Account
Section titled “1. Creating a GitHub Account”- Visit GitHub and sign up.
- Choose a username, provide an email, and create a password.
- Verify your email and set up your profile.
2. Creating a Repository
Section titled “2. Creating a Repository”- Click on New Repository.
- Enter a repository name and description.
- Choose public or private visibility.
- Initialize with a README file (optional).
- Click Create Repository.
3. Cloning a Repository
Section titled “3. Cloning a Repository”To clone a repository to your local machine, run:
git clone https://github.com/username/repository.git4. Making Changes & Pushing Code
Section titled “4. Making Changes & Pushing Code”- Navigate to the repository folder:
Terminal window cd repository - Make changes to files and stage them:
Terminal window git add . - Commit changes with a meaningful message:
Terminal window git commit -m "Added a new feature" - Push changes to GitHub:
Terminal window git push origin main
Working with Branches
Section titled “Working with Branches”Creating a New Branch
Section titled “Creating a New Branch”git checkout -b feature-branchSwitching Branches
Section titled “Switching Branches”git checkout mainMerging a Branch
Section titled “Merging a Branch”git merge feature-branchDeleting a Branch
Section titled “Deleting a Branch”git branch -d feature-branchPull Requests & Code Reviews
Section titled “Pull Requests & Code Reviews”- Push changes to a feature branch.
- Navigate to the repository on GitHub.
- Click Pull Requests > New Pull Request.
- Select the base branch and compare branch.
- Add a description and click Create Pull Request.
- Request reviewers and discuss changes.
- Once approved, click Merge Pull Request.
Managing Issues
Section titled “Managing Issues”- Create an Issue: Document bugs, feature requests, or enhancements.
- Assign Labels & Milestones: Categorize and prioritize issues.
- Close Issues: Automatically close issues with keywords in commit messages, e.g.,
Fixes #10.
GitHub Actions: Automating Workflows
Section titled “GitHub Actions: Automating Workflows”GitHub Actions enables automation of CI/CD pipelines.
Example: Running Tests on Push
Section titled “Example: Running Tests on Push”name: Run Testson: pushjobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Install dependencies run: npm install - name: Run tests run: npm testSecurity & Best Practices
Section titled “Security & Best Practices”- Enable Two-Factor Authentication (2FA).
- Use Dependabot for automatic dependency updates.
- Set up branch protection rules to prevent force pushes.
- Monitor security alerts for vulnerabilities.
GitHub Packages & Releases
Section titled “GitHub Packages & Releases”- Packages: GitHub supports package management for Docker, npm, and Maven.
- Releases: Use GitHub Releases to distribute project versions.
Conclusion
Section titled “Conclusion”GitHub combines Git hosting with review, automation, packages and security features. Continue with GitHub Actions and automation or the administration guides.