Table of contents
- What is Git and why is it important?
- What is difference Between Main Branch and Master Branch??
- Can you explain the difference between Git and GitHub?
- How do you create a new repository on GitHub?
- What is difference between local & remote repository? How to connect local to remote?
- TASKS:
- Set your user name and email address, which will be associated with your commits.
- Create a repository named "Devops" on GitHub:
- Connect your local repository to the repository on GitHub.
- Create a new file in Devops/Git/Day-02.txt & add some content to it:
- Push your local commits to the repository on GitHub:
What is Git and why is it important?
Git is a version control system that helps developers track changes to their code over time, collaborate with others, and manage multiple versions of a project. It's important because it provides a structured approach to software development, making it easier to manage and collaborate on code.
What is difference Between Main Branch and Master Branch??
In practical terms, the difference between the "main" and "master" branch is largely a matter of convention and preference. Some developers and organizations prefer to use "main" to refer to the default branch, while others continue to use "master".
Regardless of which term is used, the default branch is typically where the latest stable version of the codebase is stored, and other branches are created off of it for experimental features or bug fixes.
Can you explain the difference between Git and GitHub?
Git and GitHub are related but different tools. Git is a version control system that allows developers to track changes to their code over time and collaborate with others on the same codebase. It is a command-line tool that can be used locally on a developer's computer.
On the other hand, GitHub is a web-based hosting service for Git repositories. It provides a platform for developers to store their Git repositories in the cloud, collaborate with others, and share their code with the wider community.
How do you create a new repository on GitHub?
To create a new repository on GitHub, follow these steps:
Log in to your GitHub account.
Click on the "+" icon in the top right corner of the page.
Select "New repository" from the dropdown menu.
Enter a name for your repository.
Add a description if you like (optional).
Choose whether you want the repository to be public or private.
Select the checkbox to "Initialize this repository with a README" (optional).
Choose a license if you like (optional).
Click "Create repository".
What is difference between local & remote repository? How to connect local to remote?
A local repository is a copy of a Git repository that is stored on your own computer, while a remote repository is a copy that is stored on a remote server or hosting service, such as GitHub.
TASKS:
Set your user name and email address, which will be associated with your commits.
git config --global user.name "<name>" git config --global user.email "<email id>" To check git config --list
Create a repository named "Devops" on GitHub:
Connect your local repository to the repository on GitHub.
At first Go to your Repository and copy the URL :
git remote add origin <URL>
Create a new file in Devops/Git/Day-02.txt & add some content to it:
At First Clone this Repo into your local machine:
git clone <URL>
Create a file in Devops/Git:
Commit it :
git commit -m "<your message"
Push your local commits to the repository on GitHub:
git push -u origin <present branch>
you can check it : git branch
You can check it on your Github Account:
\=======================THANKYOU==========================