GitHub

GitHub is a web-based hosting service for version control using Git. It provides the distributed version control and source code management functionality of Git, plus its own features.

GitHub Clone Repository

GitHub

Clone a GitHub repository to your local machine

git clone https://github.com/username/repository.git

GitHub Initialize Repository

GitHub

Initialize a new Git repository in the current directory

git init

GitHub Add Remote

GitHub

Add a remote GitHub repository to your local Git repository

git remote add origin https://github.com/username/repository.git

GitHub Stage Changes

GitHub

Stage all changes in the current directory for commit

git add .

GitHub Commit Changes

GitHub

Commit staged changes with a descriptive message

git commit -m "Your commit message"

GitHub Push Changes

GitHub

Push committed changes to the remote repository

git push origin main

GitHub Pull Changes

GitHub

Pull and merge changes from the remote repository

git pull origin main

GitHub Create Branch

GitHub

Create and switch to a new branch

git checkout -b feature-branch

GitHub Switch Branch

GitHub

Switch to an existing branch

git checkout branch-name

GitHub Merge Branch

GitHub

Merge changes from another branch into the current branch

git merge feature-branch

GitHub View Status

GitHub

View the status of your working directory

git status

GitHub View Logs

GitHub

View commit history

git log

GitHub Stash Changes

GitHub

Temporarily save changes without committing

git stash

GitHub Apply Stash

GitHub

Apply previously stashed changes

git stash apply

GitHub Create Tag

GitHub

Create a new tag for a specific commit

git tag -a v1.0.0 -m "Version 1.0.0"

GitHub Push Tags

GitHub

Push all tags to the remote repository

git push origin --tags

GitHub Revert Commit

GitHub

Create a new commit that undoes changes from a previous commit

git revert commit-hash

GitHub Reset Hard

GitHub

Reset to the previous commit, discarding all changes

git reset --hard HEAD~1

GitHub Reset Soft

GitHub

Reset to the previous commit, keeping changes staged

git reset --soft HEAD~1

GitHub Configure User

GitHub

Set your name for Git commits

git config --global user.name "Your Name"

GitHub Configure Email

GitHub

Set your email for Git commits

git config --global user.email "your.email@example.com"

GitHub Create Pull Request

GitHub

Create a pull request using GitHub CLI

gh pr create

GitHub View Pull Requests

GitHub

List pull requests using GitHub CLI

gh pr list

GitHub Merge Pull Request

GitHub

Merge a pull request using GitHub CLI

gh pr merge