Repository files navigation
Git & GitHub Learning Guide
1. What is Git and GitHub?
Git is a distributed version control system (DVCS) that tracks changes in files and enables collaboration.
Key Features:
Maintains a history of file changes.
Allows reverting to previous states.
Enables branching and merging.
Example Alternatives: Mercurial, Bazaar, Darcs.
A cloud platform for hosting Git repositories and enabling collaboration.
Functions:
Centralized repository for teams.
Simplifies code merging and version control across the globe.
Difference:
Git: Local version control.
GitHub: Global collaboration platform using Git.
2. Setting Up Git and GitHub
Download from git-scm.com and install.
Verify installation:
Installing GitHub Desktop
GitHub Desktop: GUI tool for managing repositories.
Setup Steps:
Download from desktop.github.com .
Configure using your GitHub account.
Initialize Git:
Configure username and email:
git config --global user.name " Your Name"
git config --global user.email " youremail@example.com"
Verify configuration:
3. Git Basics and Workflow
Working Directory : Local files you're editing.
Staging Area : Prepares changes for the next commit.
Local Repository : Stores committed changes on your machine.
Remote Repository : Centralized repository (e.g., GitHub).
Initialize a Repository :
Add Files to Staging Area :
git add filename
git add . # Adds all changes
Commit Changes :
git commit -m " Commit message"
Push to Remote :
git remote add origin < repository_url>
git branch -M main
git push -u origin main
Pull Changes :
4. Git Branching and Collaboration
Create a branch:
Switch to a branch:
Merge branches:
Resolving Merge Conflicts
Use a code editor to resolve conflicts.
Add changes after resolving:
Commit the resolution:
git commit -m " Resolved merge conflict"
5. Learning and Practice Resources
Use meaningful commit messages :
git commit -m " Fix: Resolved bug in login logic"
Keep your repository organized with clear branching strategies.
Regularly pull changes from the remote repository to stay updated.
Version Control Systems Comparison :
Centralized: Subversion.
Distributed: Git, Mercurial.
Understanding .gitignore :
List files/folders to exclude from tracking.
Licenses in Repositories :
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
You can’t perform that action at this time.