GitHub
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
Clone a GitHub repository to your local machine
git clone https://github.com/username/repository.git
GitHub Initialize Repository
Initialize a new Git repository in the current directory
git init
GitHub Add Remote
Add a remote GitHub repository to your local Git repository
git remote add origin https://github.com/username/repository.git
GitHub Stage Changes
Stage all changes in the current directory for commit
git add .
GitHub Commit Changes
Commit staged changes with a descriptive message
git commit -m "Your commit message"
GitHub Push Changes
Push committed changes to the remote repository
git push origin main
GitHub Pull Changes
Pull and merge changes from the remote repository
git pull origin main
GitHub Create Branch
Create and switch to a new branch
git checkout -b feature-branch
GitHub Switch Branch
Switch to an existing branch
git checkout branch-name
GitHub Merge Branch
Merge changes from another branch into the current branch
git merge feature-branch
GitHub View Status
View the status of your working directory
git status
GitHub View Logs
View commit history
git log
GitHub Stash Changes
Temporarily save changes without committing
git stash
GitHub Apply Stash
Apply previously stashed changes
git stash apply
GitHub Create Tag
Create a new tag for a specific commit
git tag -a v1.0.0 -m "Version 1.0.0"
GitHub Push Tags
Push all tags to the remote repository
git push origin --tags
GitHub Revert Commit
Create a new commit that undoes changes from a previous commit
git revert commit-hash
GitHub Reset Hard
Reset to the previous commit, discarding all changes
git reset --hard HEAD~1
GitHub Reset Soft
Reset to the previous commit, keeping changes staged
git reset --soft HEAD~1
GitHub Configure User
Set your name for Git commits
git config --global user.name "Your Name"
GitHub Configure Email
Set your email for Git commits
git config --global user.email "your.email@example.com"
GitHub Create Pull Request
Create a pull request using GitHub CLI
gh pr create
GitHub View Pull Requests
List pull requests using GitHub CLI
gh pr list
GitHub Merge Pull Request
Merge a pull request using GitHub CLI
gh pr merge