Sure!
Here’s the clean, formatted text ready for you to copy-paste into any document editor
(like Word or Google Docs) and export as PDF easily.
Git & GitHub Experiment Guide: Step-by-
Step Instructions
Step 0: Setup
Install Git:
o Windows: https://git-scm.com/download/win
o Mac: Use Homebrew (brew install git) or download from https://git-
scm.com/
o Linux: Use your package manager (sudo apt install git or sudo yum
install git)
Create a GitHub account at https://github.com
Step 1: Configure Git
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"
Check your configuration:
git config --global user.name
git config --global user.email
Step 2: Create a New Local Repository
mkdir my-git-experiment
cd my-git-experiment
git init
Step 3: Create or Add Files
echo "Hello Git" > file1.txt
echo "Another file" > file2.txt
Step 4: Check Status
git status
Step 5: Stage Files
git add file1.txt file2.txt
Or stage all files:
git add .
Step 6: Commit Changes
git commit -m "Initial commit with two files"
Step 7: Create a GitHub Repository
Go to GitHub and create a new repository (e.g., my-git-experiment)
Do NOT initialize with README or .gitignore (since you already have a local repo)
Step 8: Link Local Repository to GitHub Remote
git remote add origin https://github.com/yourusername/my-git-experiment.git
git remote -v
Step 9: Push to GitHub
git push -u origin main
Note: Use master instead of main if your default branch is named master.
Step 10: Pull Changes
Make a change on GitHub or in another clone, then run:
git pull origin main
Step 11: Branching
Create and switch to a new branch:
git checkout -b feature-branch
Make changes and commit:
echo "Feature work" >> file1.txt
git add file1.txt
git commit -m "Added feature work to file1.txt"
Step 12: Merge Branch
Switch to the main branch:
git checkout main
Merge the feature branch into main:
git merge feature-branch
Step 13: Rebase (Optional)
Switch to feature branch and rebase onto main:
git checkout feature-branch
git rebase main
Step 14: Push Branches to GitHub
Push your feature branch:
git push -u origin feature-branch
Push main branch if updated:
git push origin main
Step 15: Stash (Optional)
Save uncommitted changes:
echo "Temporary changes" >> file2.txt
git stash
Check status (working directory will be clean):
git status
Apply stashed changes later:
git stash apply
Summary of Useful Commands
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git init
git status
git add <file(s)> or git add .
git commit -m "message"
git remote add origin <url>
git push -u origin main
git pull origin main
git branch <branchname>
git checkout <branchname>
git checkout -b <newbranch>
git merge <branchname>
git rebase <branchname>
git push -u origin <branchname>
git stash
git stash apply