What is Git?
Git is a version control system that records every change to your files, lets you create branches to try ideas, and helps teams work together. GitHub and GitLab are websites that host Git repositories.
How Git works
-
1
Initialise
git init turns a folder into a repository.
-
2
Stage
git add chooses which changes go into the next save.
-
3
Commit
git commit stores a snapshot with a message.
-
4
Share
git push uploads your commits to GitHub or GitLab.
What is version control?
A history of your project: who changed what, when, and why — with the power to go back.
Core words
- Repository: the project and its history
- Commit: one saved change
- Branch: a separate line of work
- Merge: bring branches together
Git first steps
git initStart a repository
git statusSee what changed
git add . && git commit -m "first"Save your changes
git log --onelineRead the history
git switch -c new-ideaCreate and move to a branch
Use Git safely and legally
Never commit passwords, API keys or private files. Add them to .gitignore, and change any secret that was committed by mistake.
Practise only on your own computer, your own network or a lab that gives you permission. Using security tools on systems that are not yours can be a crime (in India under the IT Act).
Git — common questions
What is Git used for?
Git is a version control system that records every change to your files, lets you create branches to try ideas, and helps teams work together. GitHub and GitLab are websites that host Git repositories.
Git kya hai?
Git ek version control system hai jo aapke code ke har badlaav ka record rakhta hai.
Git and GitHub — same thing?
No. Git is the tool on your computer; GitHub is a website that stores Git repositories.
How do I undo my last commit?
git reset --soft HEAD~1 undoes the commit and keeps your changes.
Related topics: git tutorial · git kya hai · git commands for beginners · github basics hindi