easy
Git & GitHub Easy​
What is Git?
Git: Git is a version control system that helps developers to track changes in their code, collaborate with others, and manage codebase history.
What is GitHub?
GitHub: GitHub is a web-based platform that acts as a central hub for managing and tracking changes to computer code using a version control system called Git. It provides a collaborative environment for software developers to work on projects, share code, and keep track of modifications made by team members.
What is the difference between Git and GitHub?
Git is a version control system, while GitHub is a platform for hosting Git repositories.
Git allows users to manage and track changes to their codebase while GitHub allows multiple developers to work on the same project, contribute code, and collaborate seamlessly.
Git is typically used locally on a developer's machine and can operate independently of any online platform.
What is a repository in Git?
- A repository, also known as a repo in Git, is simply a version-controlled folder that holds all of the files and revision history for an entire project.
- advantages of git repository are records changes, improves teamwork, and helps you roll return project updates.
- A repository is a location where you can store project-related data, like files, commit histories, branches, and more.
- It can be locally located on your computer or remotely located on a server.
- Consider it as a record of your project's progress as well as a picture taken at a particular point in time.
How to track changes in Git? And what is staging area?
Using the version control system to maintain up to date on changes to your codebase is part of tracking changes in Git. The following steps are usually involved in the process:
Initialize a Git repository:
- To create a new Git repository, use
git init
in the project directory. Add files to the staging area
Add files to the staging area:
- Before submitting changes, you must add the files you need to the repository. To add a particular file to the repository, use the command
git add <fileName>
, as well asgit add .
(to add all  modification)
Commit changes:
- After adding files to the staging area, commit the changes using
git commit -m "Your commit message"
. This creates a snapshot of the files in the repository.
What is commit in Git?
- In Git, committing changes is similar to taking a current photo of your project.
- All the changes and updates you made to your files are recorded and maintained in the Git repository.
- So, to explain it simply, committing via Git is the same as recording and maintaining the current condition of your files at the time of the commit.
Staging Changes:
- Before making a commit, you stage the changes using the git add command.
Committing Changes: - Once the changes are staged, you commit them using the git commit command.