Git Learning
Source: Dev.to
What is Git
Git was created by Linus Torvalds in 2005.
Version Control Systems
Types of Version Control Systems
1. Local VCS
- Example: (none provided)
- Limitations:
- No collaboration
- Risk of data loss
2. Centralized VCS
- Example: (none provided)
- How it works: (description not provided)
3. Distributed VCS
- Examples:
- Git
- Advantages:
- Each developer has complete history
- Can work offline
- Changes are pushed later to platforms like GitHub or GitLab
How Git Works
Workflow:
Working Directory → Staging Area → Local Repository → Remote Repository
git add– moves changes to the staging areagit commit– saves changes locallygit push– uploads changes to the remote repository
Components
- Working Directory
- Staging Area
- Repository – storage location where Git tracks all versions of a project’s files and maintains its full history.
- Local repository
- Remote repository
What is GitLab
Connecting Git to GitLab
- Create a repository on GitLab.
- Connect your local repo:
https://gitlab.com/username/portfolio.git
- Your local changes are now visible on GitLab.