Git & GitLab Day 1
Day 1 of my full stack development in java ....
Here I am mentioned my doubts and my learnings on my first day....
1. Version Control: Centralized vs. Decentralized
Centralized Version Control (CVCS):
- Example: Subversion (SVN), Perforce.
- How it works: There’s a central repository where all the version-controlled files are stored. Developers check out files, make changes, and then check them back into the central repository.
-
Advantages:
- Easier to manage and control since all the code is in one central place.
- Simpler for smaller teams or organizations.
-
Disadvantages:
- The central repository is a single point of failure. If it's down, no one can commit or access the repository.
- Limited offline access.
Decentralized Version Control (DVCS):
- Example: Git, Mercurial.
- How it works: Each developer has a full copy of the repository (including its history). Changes are made locally and then pushed to remote repositories like GitLab or GitHub.
-
Advantages:
- No single point of failure, and developers can work offline and still access the entire history of the project.
- Branching and merging are more powerful and flexible.
-
Disadvantages:
- More complex workflows due to the decentralized nature.
- Requires discipline to keep local repositories synchronized with the main project.
2. Why Linux over Windows for Development?
- Open Source: Linux is open-source, allowing developers to modify and customize the OS to fit their needs. This is great for programmers who want more control.
- Better Command-Line Tools: Linux has powerful built-in command-line utilities, which makes tasks like managing code, installing software, and configuring systems more efficient.
- Package Management: Linux has package managers (like APT for Ubuntu or YUM for Fedora), making it easy to install and manage development tools.
- Stability and Performance: Linux is known for its stability and performance, especially for server-side applications.
- Security: Linux is more secure by design, which is important when managing code and servers.
- Development Tools: Many programming languages and tools (like Git, Docker, Node.js, etc.) are developed first for Linux, and it often provides better compatibility.
3. Why GitLab over GitHub?
- Self-Hosting: GitLab allows you to host your own GitLab instance, giving you full control over your repositories and privacy.
- Integrated DevOps: GitLab provides an integrated CI/CD pipeline, issue tracking, and project management in a single interface, unlike GitHub, which often requires third-party integrations for some of these features.
- More Features in the Free Plan: GitLab has more built-in features for free, such as private repositories, CI/CD pipelines, and project management tools.
- Enterprise Support: GitLab offers a robust enterprise version, which is ideal for organizations that need additional support, features, and security.
- Better for Team Collaboration: GitLab’s features like built-in CI/CD, code reviews, and issue tracking make it excellent for collaborative team environments.
- Security and Compliance: GitLab provides tools for managing secure software development, compliance, and monitoring.
4. Why Git over Other Version Control Systems?
- Distributed Nature: Git allows developers to work offline and still have access to the full history of the project, unlike centralized systems like SVN.
- Speed and Efficiency: Git is optimized for performance, especially for large projects, thanks to its efficient handling of branches and commits.
- Flexibility in Branching and Merging: Git makes branching and merging much easier and more flexible than other VCS systems.
- Popularity and Community: Git is the most widely used version control system, meaning there’s a large community, plenty of documentation, and lots of third-party tools and integrations.
- Integration with Platforms: Git integrates seamlessly with platforms like GitHub, GitLab, Bitbucket, making it an easy choice for developers looking for cloud-based collaboration.
5. Other Version Control Systems (VCS):
- Subversion (SVN): Centralized version control. It’s good for large teams with central server access but lacks the flexibility of Git.
- Mercurial (Hg): Another decentralized version control system similar to Git but with a simpler interface.
- Perforce: Used for large codebases, especially in gaming and enterprise applications. It’s centralized and handles binary files well.
- Bazaar (Bzr): A version control system that supports both centralized and decentralized models.
- CVS (Concurrent Versions System): One of the oldest version control systems, but now considered outdated and replaced by newer systems like Git and SVN.
6. Windows Applications vs. Web Applications:
-
Windows Applications: These are software programs designed to run on the Windows operating system. They typically need to be installed on your machine and are often optimized for the Windows environment.
- Example: Microsoft Office, Adobe Photoshop, etc.
- Pros: Can offer high performance and more control over the system.
- Cons: Can be less portable (requires installation on each machine) and are limited to the Windows platform unless you use something like Wine (for Linux).
-
Web Applications: These are apps that run in a web browser and are platform-independent.
- Example: Google Docs, Trello, GitHub, GitLab.
- Pros: Accessible from any device with a browser, no installation required, updates happen automatically.
- Cons: Performance may depend on internet speed, and some features may not be as powerful as desktop apps.
7. Why Linux Mint?
- Beginner-Friendly: Linux Mint is known for being user-friendly, especially for those transitioning from Windows. It has a familiar desktop interface (Cinnamon) and is easier to set up than some other Linux distributions.
- Great for Developers: Mint is based on Ubuntu, which has excellent support for developers, making it easy to install development tools and software.
- Stable and Reliable: Linux Mint is known for its stability and reliability, which is why it’s a great choice for both beginners and advanced users.
- Lightweight: It doesn’t require high system resources, which makes it a good option for older hardware or for developers who want a fast, responsive system.
**Introduction to day 2:
- Briefly introduce Git and GitLab:
- Git: A distributed version control system.
- GitLab: A web-based platform for Git repositories that also supports continuous integration and DevOps.
1. How to Install Git on Linux:
- Step 1: Update Package Index
`sudo apt update`
-
Step 2: Install Git
- For Ubuntu/mint:
sudo apt install git
- Step 3: Verify Installation
- Check the installed version of Git:
git --version
2. Create a GitLab Account:
- Step 1: Visit GitLab (https://gitlab.com) and click on "Register" if you don’t have an account already.
- Step 2: Fill in your details (name, email, password) to create an account.
- Step 3: Verify your email address.
- Step 4: Log in to GitLab.
3. Create a Group on GitLab:
- Step 1: After logging in, click on the "Groups" option in the left menu.
- Step 2: Click on "New Group" to create a group.
- Step 3: Fill out the group name, description, and select the visibility (Private, Internal, or Public).
- Step 4: Click "Create Group."
4. Create a Project in GitLab:
- Step 1: Go to your newly created group.
- Step 2: Click on "New Project."
- Step 3: Choose whether it’s a blank project, importing from another repository, or using a template.
- Step 4: Fill in the project name, description, and select the visibility (Public, Private, or Internal).
- Step 5: Click "Create Project."
5. Privacy Settings:
-
Changing Privacy of Project:
- You can change the visibility of your project at any time by going to the project’s Settings > General > Visibility, project features, permissions.
- Visibility options:
- Private: Only members can see and contribute.
- Internal: Any signed-in user can view but not contribute.
- Public: Anyone can see and contribute.
-
What if you can't change the privacy settings?
- This could be due to your role within the project (you may need owner permissions) or limitations set by the admin.
6. Basic Git Commands (Overview):
- Clone a Repository:
git clone
- Check the Status of Your Repository:
git status
- Stage Changes:
git add
- Or add all changes:
git add .
- Commit Changes:
git commit -m "Your commit message"
- Push Changes to GitLab:
git push origin
- Check Git Log (Commit History):
git log
- Switch Branches:
git checkout
7. History of Git and GitLab:
-
Who invented Git?
- Git was created by Linus Torvalds in 2005 to support the development of the Linux kernel.- Who invented GitLab?
- GitLab was created by Dmitriy Zaporozhets and **Valery Sizov in 2011 as an open-source alternative to GitHub.
happy learning....