This file is a simplified guide that explains the basic concepts of "Git" and "GitHub" in a clear and structured way.
This is my updated README file .
-
What is Git?
Git is a version control system that helps you track changes in your code and work with others more easily. Unlike other systems that save only the changes (called diffs), Git takes a full snapshot of your project every time you save (commit).
These snapshots make it easy to go back to any point in your project's history, and because Git works mostly locally, you don’t need an internet connection for most tasks. You can check your history, create commits, and explore changes — all offline.
Git uses something called a SHA-1 hash (a long ID made from letters and numbers) to track every version of every file. This ensures nothing gets changed or lost without Git noticing it.
-Git stores files in three main states:
-Modified: You changed the file, but didn’t save it to Git yet.
-Staged: You marked the file to be saved in the next commit.
-Committed: The file is saved safely in Git’s history.
-
Main parts of a Git project:
-Working Directory: Where your actual files live and where you make changes. -Staging Area: A place where you prepare files before saving them. -Git Directory: The database where Git stores all snapshots and project history.
-Basic Git Workflow:
1. You edit your files.
2. You use "git add" to stage the changes.
3. You use "git commit" to save the changes to your Git history.
4. Optionally, use "git push" to upload your changes to GitHub or another remote.
-What is GitHub?
GitHub is a place where you can store your code online and work on it with others. Whether you're building a personal project or collaborating with a team, GitHub helps you keep track of changes, review code, and work together without worrying about breaking anything.
It's built on top of **Git**, which is a tool that tracks every change you make to your code. That means you can go back to any previous version, see who changed what, or combine your work with others safely.
-
What can you do with GitHub?
-Save your code and access it from anywhere. -Keep a history of every change made to your project.
- Collaborate with teammates without stepping on each other's toes.
- Review code, leave comments, and test ideas in separate branches. -If your project is open source, others can view it and contribute too.
-
So what's the difference between Git and GitHub?
-Git:is the actual version control tool. It runs locally on your computer and helps you manage changes. -GitHub: is a cloud platform that uses Git and adds features for sharing, collaborating, and managing projects online.
-Basic Git commands
-git clone: creates a local copy of a project that already exists remotely. The clone includes all the project's files, history, and branches.
-git add: When you change something in your project—like editing a file or creating a new one—Git notices, but it doesn't save those changes to the project history right away.
To actually save changes, there are two steps: Stage the change (git add), Commit the change(git commit)
- git commit command saves a snapshot of your changes and records them in your project’s history.
Think of it like taking a photo of your work at a specific point in time. Everything you previously prepared using git add will now be officially saved when you run git commit.
-git push: updates the remote repository with any commits made locally to a branch.
-gitignore file tells Git which files or folders to ignore—meaning Git won’t track them or upload them to GitHub.
- pull request is a way to ask if your changes can be added to the main project.
You make changes in one branch, then send a pull request to suggest adding those changes to another branch.Other people can look at your changes, talk about them, and suggest edits before the changes are accepted.The pull request shows the differences between your branch and the main one.