Git & GitHub – The Only Guide You Need to Start Version Control Like a Pro

Advance git comments to learning..

git diff – See the Difference Between Commits Want to know what changed between two commits? Use:

git diff commit1 commit2 This will show you line-by-line changes between those commits. Perfect for code reviews or debugging.

git log – The History Book of Your Repo This command shows a timeline of commits. Each log entry includes:

Commit hash Author Date Commit message

git log Use it like a Git database to see who did what, and when.

git clone – Bring a Remote Repo to Your Machine Cloning is how you copy a project from GitHub to your local system for the first time:

git clone <repo_url> Now you're working locally with the full history and files.

git fork – Copy Someone Else's Repo into Your GitHub Used on GitHub (not the CLI), forking lets you copy someone’s repository into your own account. Once forked, you can clone it, make changes, and even open pull requests back to the original.

git pull – Update Your Local with Remote Changes Someone else pushed changes to the repo? You need to pull them in:

git pull This updates your local branch with the latest commits from the remote.

git push – Send Your Local Commits to Remote Once you’ve made commits locally, push them to GitHub:

git push This keeps your remote repo in sync with your local work.

git blame – See Who Changed What Line Want to know who edited that one line and when? Run:

git blame <filename> Each line will be annotated with the commit hash and author. Great for debugging or giving credit.

Git Merge Conflicts – When Things Don’t Auto-Merge If two branches change the same part of a file, you’ll get a conflict when merging. Git can’t decide which version to keep—you have to fix it manually.

Once you fix the conflict, mark it resolved:

git add <conflicted_file> git commit Now your merge is complete.

git branch – Create & Switch Between Lines of Development To see branches:

git branch To create and switch to a new branch:

git checkout -b new-branch-name Or use the modern version:

git switch -c new-branch-name

gitignore – Exclude Unwanted Files Don't want certain files (like node_modules/, .env, or logs) in your repo?

Create a .gitignore file and list them:

node_modules/ .env *.log This keeps your repo clean and secure.

GitHub Wiki – Document Your Project Every GitHub repo can have a Wiki section. Use it to:

Document features Explain setup Onboard new contributors