This repository was created to learn Git and GitHub more practically by implementing all commands.
I have included all of the concepts I have learned in this readme file, do use it.
- What is Git?
- What is GitHub?
- Installing Git
- Configuring Git
- Basic Git Workflow
- Important Git Commands
- Branching and Merging
- Remote Repositories
- Stashing and Cleaning
- Git Logs and History
- GitHub Workflow
- Collaborating on GitHub
- Advanced Git Commands
- Troubleshooting Git Issues
- Resources
Git is a distributed version control system designed to track changes in source code efficiently. It enables multiple developers to collaborate on projects by maintaining version histories and managing branches.
GitHub is a web-based platform for version control and collaboration using Git. It provides hosting for Git repositories and adds features like pull requests, issue tracking, and project management tools.
- Windows: Download from git-scm.com and follow the installer.
- Mac: Use Homebrew:
brew install git
. - Linux: Use the package manager:
sudo apt-get install git # Debian/Ubuntu sudo yum install git # RHEL/CentOS
Verify installation:
git --version
Set up your identity:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Check configuration:
git config --list
- Initialize a repository:
git init
- Add files to staging area:
git add <file> git add . # Add all changes
- Commit changes:
git commit -m "Commit message"
- Push to remote repository:
git push origin main
git init
git clone <repository-url>
git status
git add <file>
git add .
git commit -m "Your message here"
git log
git diff
git branch <branch-name>
git checkout <branch-name>
git checkout -b <branch-name>
git merge <branch-name>
git branch -d <branch-name>
git remote add origin <repository-url>
git remote -v
git push origin <branch-name>
git pull origin <branch-name>
git stash
git stash apply
git stash drop
git clean -f
git log
git log --oneline
git log --graph --oneline --all
- Create a repository on GitHub.
- Clone it locally:
git clone <repository-url>
- Make changes, stage, and commit:
git add . git commit -m "Description of changes"
- Push changes:
git push origin main
- Click "Fork" on GitHub.
- Clone your fork:
git clone <fork-url>
- Commit changes to your fork.
- Push changes and click "Pull Request" on GitHub.
git revert <commit-hash>
git reset --hard <commit-hash>
git rebase <branch>
git cherry-pick <commit-hash>
git reset --soft HEAD~1
- Edit conflicted files.
- Add changes:
git add <file>
- Commit:
git commit
git status
Git and GitHub for Beginners - Crash Course | freeCodeCamp
Git and GitHub learning resources | GitHub
This README aims to serve as a quick reference for all key Git and GitHub concepts. Happy coding!