Basic Commands Guide
Q1. Make your first project
Ans.
Select Dir Wherr you create Project
mkdir my-first-project
cd my-first-project
git init
mkdir made a new folder
cd went inside that folder
git init told Git: “start tracking this folder”
Q2. Create a file and save a version
Ans.
Create a file:
echo "Hello Git" > hello.txt
Now check the status:
Setup Run : git status
Git will say hello.txt is untracked (Git sees it but is not saving it yet).
Now do the two-step save:
Setup Run : git add hello.txt , git commit -m "My first commit"
git status
git add hello.txt
git commit -m "My first commit"
git commit = actually save it with a message (like sealing the box and writing a label)
🎉 You just made your first commit!
Q3. See your history
Ans.
You will see your commit with your message, name, and date.
git log
Change your files
git add . (the dot means “all changed files”)
git commit -m "describe what you changed"
That’s 80% of daily Git use.
Q4. Quick cheat sheet
Ans.
Start Git in a folder
Setup Run : git init
See what changed
Setup Run : git status
Choose all changes to save
Setup Run : git add .
Save a version
Setup Run : git commit -m "msg"
See history
Setup Run : git log
git init
git status
git add .
git commit -m "msg"
git log