GitHub is a platform for version control and collaboration. It allows developers to manage and track changes in their projects using Git.
- Visit GitHub and sign up.
- Set up two-factor authentication (2FA) for security.
- Download from git-scm.com
- Set up your username and email:
git config --global user.name "Your Name" git config --global user.email "you@example.com"
- Click New Repository on GitHub.
- Initialize with README,
.gitignore
, and license. - Clone the repository:
git clone https://github.com/your-username/repo-name.git
- Create a new branch:
git branch feature-branch git checkout feature-branch # Switch to branch
- Merge changes:
git checkout main git merge feature-branch
- Make changes, then stage and commit:
git add . git commit -m "Added new feature"
- Push changes:
git push origin feature-branch
- Go to Pull Requests tab on GitHub.
- Click New Pull Request, compare branches, and submit.
- Merge the PR after review.
- Report bugs or suggest features in Issues.
- Use labels, milestones, and assignments.
- Start discussions under the Discussions tab.
- Fork: Make a copy of a repository.
- Clone: Copy a repository locally.
git clone https://github.com/original-owner/repo.git
- Automate workflows using CI/CD.
- Example
.github/workflows/main.yml
:name: CI Workflow on: push jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2
- Use Releases to version your project.
- Create a tag:
git tag -a v1.0 -m "Initial release" git push origin v1.0
- Host static websites directly from a repository.
- Go to Settings → Pages, choose the branch, and deploy.
- Enable Dependabot for vulnerability alerts.
- Use Code Scanning to detect issues.
- Invite collaborators.
- Use team reviews and protected branches.
- Install GitHub CLI
(gh)
- Authenticate with
gh auth login
- Clone, create, and manage repositories from the terminal
- Automate workflows with
.github/workflows/
- Run tests, deployments, and scripts automatically
- Example: Auto-deploy a React app to GitHub Pages
- Create a Kanban board for task management
- Assign issues to project milestones
- Track progress with automation
- Engage with the community on projects
- Start discussions, ask questions, and share ideas
- Use AI-based code suggestions
- Works with VS Code, JetBrains, and Neovim
- Host static websites using
gh-pages
branch - Free hosting for portfolios and documentation
- Dependabot: Automatically updates dependencies
- Code Scanning: Detect security vulnerabilities
- Secret Scanning: Protect sensitive information
GitHub is a powerful tool for software development. Mastering its features helps in efficient collaboration, version control, and automation.
📌 Need more? Refer to the GitHub Docs
- Managing multiple remotes (
git remote add origin
) - Squashing commits (
git rebase -i HEAD~n
) - Stashing changes (
git stash
) - Using
.gitignore
effectively