Table of contents
βοΈWhat is Git and Why it is important?
Git is a distributed version control system that helps developers to manage their code changes.
π‘οΈwhy it is crucial:
Version Tracking:
Git enables developers and users to track changes to files, allowing them to revert to specific versions as needed.
Collaboration:
Multiple individuals can collaborate on the same project and seamlessly merge changes.
Local and Remote Repositories:
Git stores files and their history locally but can also be utilized with online hosts such as Bitbucket or GitHub for collaborative purposes.
π³π Difference between the Main Branch and Master Branch?
π³ Main branch: It's also referred to as the default branch in Git, typically where the most development happens.
π Master branch: Historically used as the main integration branch, but some prefer using "main" instead due to its more comprehensive meaning.
π»π Difference between Git and GitHub?
π» Git: A software tool for local version control. Files and their history are stored on a local computer.
π GitHub: A remote platform built on top of Git, where we can upload changes, collaborate, and share code with others.
π How to create a new repository on GitHub?
Steps to create a repo:
Log in to GitHub.
Click the β+β icon in the top right corner and select βNew repository.β
Name your repository (e.g., βDevopsβ).
Choose visibility (public or private).
Initialize with a README (optional).
Click βCreate repository.β
β‘ Difference between Local and Remote Repositories?
π Local Repository: Stored on the local computer and used Git commands to manage it.
π Remote Repository: Hosted on platforms like GitHub, encouraging collaboration and sharing.
πTasks: Connecting Local to Remote Repository
πΎ Step 1: Set Git username and email
# Set Git username
git config --global user.name "Your Name"
# Show the username
git config --global --get user.name
# Set Git useremail
git config --global user.email "you@example.com"
# Show the useremail
git config --global --get user.email
πΎ Step 2: Create a new repository on GitHub (e.g., βDevopsβ)
πΎ Step 3: In the local repository, add the remote URL
# Initialize a Git repo locally.
git init
git remote add origin <repository_url>
πΎ Step 4: Create a new file in Devops/Git/Day-02.txt & add some content to it
πΎ Step 5: Push local commits to the remote
git push -u origin main
OR
git push
Happy coding! ππ©βπ»π¨βπ»
β Feel free to reach out if you have any questions. I'm delighted to help! π
π€ Let's Connect..!
π LinkedIn
π Twitter
π GitHub
βοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈβοΈ