Git is a distributed version control system that helps developers track changes, collaborate efficiently, and manage code versions.
Git is a version control system, while GitHub is a hosting service that provides cloud-based repositories and collaboration tools.
You can use:
git reset --hard <commit-hash> (Dangerous: overwrites history)git revert <commit-hash> (Safer: creates a new commit that undoes changes)Use:
git status to identify conflictsgit add <file> and git commit to save the resolved mergegit reset --soft HEAD~1 (Keep changes in staging)git reset --mixed HEAD~1 (Keep changes in working directory)git reset --hard HEAD~1 (Discard changes completely)Run git log or git log --oneline --graph --all for a structured view.
Use:
git branch feature-branch (Create a new branch)git checkout feature-branch or git switch feature-branch (Switch to it)git stash temporarily saves uncommitted changes without committing them, so you can switch branches safely.
Run:
git pull and git fetch?git fetch downloads changes from the remote repository without applying them.git pull downloads and merges the changes automatically.Answer:
git merge and git rebase?Answer:
git merge creates a new merge commit and preserves history.git rebase reapplies commits on top of another branch, making the history cleaner.Answer:
HEAD is a pointer that represents the current commit in a branch.
git pull and git fetch?Answer:
git fetch downloads changes without merging.git pull fetches and merges in one step.Answer:
git status to check conflicts.git add <file>.git commit -m "Resolved merge conflict".Answer:
git reset --soft HEAD~1 (Undo commit, keep changes staged)git reset --hard HEAD~1 (Undo commit and remove changes)git revert <commit-hash> (Create a new commit that undoes changes)Answer:git stash temporarily saves uncommitted changes. Use:
Answer:
git branch -d <branch-name>git push origin --delete <branch-name>Answer:
Use: git branch -r
git bisect, and how does it help debug issues?Answer:git bisect helps find a faulty commit using binary search:
We are Recommending you:
Master Your Time with the 80/20 Rule: A...
Get Control of Your Time: 6 Easy Ways...
India’s startup space is booming in 2025....
India breeds dreamers who build empires....
Stress creeps up in 2025—work, screens,...
To place INR currency symbol in pdf while...
Artisan is "command line interface"...
1. Tell Me About Yourself ?This is often the...
How to Check SSD or HDD on Your PCAre you...