1. Introduction to Version Control Systems (VCS)
- What is Version Control?
- Types of VCS: Local, Centralized, and Distributed (Git is Distributed)
2. Getting Started with Git
- Installation:
- Linux:
sudo dnf install git (Fedora)
- Verify:
git --version
- Git Configuration:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
- Basic Commands:
git init - Initialize a repository
git status - Check status of files
git add <file> or git add . - Stage files
git commit -m "Your message" - Commit changes
git log - View commit history
git diff - See differences between versions
3. Working with Remote Repositories (GitHub/GitLab)
- Connecting Local Repo to Remote:
git remote add origin <repository-URL>
git push -u origin main
- Cloning a Repository:
git clone <repository-URL>
- Pushing and Pulling Changes:
git push - Upload local commits
git pull - Fetch and merge changes from remote
4. Branching and Merging
- Branch Basics:
git branch - List branches
git branch <branch-name> - Create new branch
git checkout <branch-name> - Switch branches
git merge <branch-name> - Merge branches
- Conflict Resolution:
- Handling merge conflicts manually in code
git add & git commit after resolving conflicts
5. Forking and Open Source Contribution (GitHub)
- Fork a repository on GitHub
- Clone the forked repo:
git clone <fork-URL>
- Make changes, commit, push
- Create a Pull Request (PR) to contribute back
6. Handling Pull Requests and Code Reviews