#1. Create a New Git Repository
##Copy code
git init
(Run inside your project folder to start tracking it with Git.)
##2. Add Files to Staging
##Copy code
git add filename.txt      # Add a specific file
git add .                 # Add all changes in the folder
##3. Commit Changes (Save a Version)
##Copy code
git commit -m "Your message describing the change"
##4. Update (Make More Changes & Save Again)
##Copy code
### Edit your files...
git add .
git commit -m "Updated feature or fixed bug"
##5. View Commit History (Retrieve Versions)
##Copy code
git log                   # Shows all commits
git log --oneline         # Shorter view
##6. Checkout a Previous Version
##Copy code
git checkout <commit_id>
(Find <commit_id> from git log.)
##💡 Tip: If you want to go back to the latest version after checking out an old one:
##Copy code
git checkout main
exit
#CLEAN CODE
git init
#(Run inside your project folder to start tracking it with Git.)
#git add filename.txt      # Add a specific file
git add .                 # Add all changes in the folder
git commit -m "BASE FILE v1 "

git add .
git commit -m "Updated feature or fixed bug"
git log                   # Shows all commits
git log --oneline         # Shorter view
git checkout <commit_id>
(Find <commit_id> from git log.)
git checkout main
#Restore a file
git restore fileName
#see Versions of a file
git log -- README.md
git log -p -- README.md
# Create branch
git branch feature-login
This creates a branch called feature-login but keeps you on your current branch.
# get list of branches
git branch
#change/switch to branch
git checkout -b <branch-name>

#Push to remote
git push origin <branch-name>

Compare -diff file between branch versions
git diff --name-only <branch1> <branch2>
#show diff in files
git diff  <branch1> <branch2>
# Show Current Branch - also shows in git-status
git branch --show-current
#Restore a branch
git restore --source main  --staged --worktree .
#show what branch is active
git log -1 HEAD
