30 November 2023

#GIT

#GIT

Key Concepts


Topic SubTopic Basic Intermediate Advanced Expert
Introduction What is Git, Version Control concepts, Git vs SVN
Installation & Setup Install Git, Initial configuration, SSH keys
Core Concepts Repository, Working directory, Staging area
Basic Commands git init, git clone, git add, git commit, git status, git log
Branching git branch, git checkout, git switch, git merge
Remote Repositories git remote, git fetch, git pull, git push
Collaboration Forking, Pull requests, Code review workflow
Merging & Conflicts Merge strategies, Conflict resolution, Rebase basics
Stashing & Cleaning git stash, git clean, temporary changes
Advanced Branching git rebase, cherry-pick, revert, reset
Tags & Releases Annotated tags, Lightweight tags, Versioning
Undo & Recovery git reflog, reset, revert, checkout recovery
Git Internals Object model, Blobs, Trees, Commits, SHA-1
Hooks & Customization Git hooks, Aliases, Custom configs
Performance & Scaling Large repos, Git LFS, Submodules, Monorepos
Security GPG commit signing, Credential management
CI/CD Integration GitHub Actions, GitLab CI, Jenkins with Git
Best Practices Commit message guidelines, Branch strategy (GitFlow, trunk-based), Code reviews
Tools & GUIs GitHub Desktop, SourceTree, GitKraken, IDE plugins
Troubleshooting Common errors, Detached HEAD, Merge issues, Debugging history

Interview question

1. Git Basics

  1. What is Git, and why is it used?
  2. What is the difference between Git and other VCS like SVN?
  3. Explain the difference between a repository, a working directory, and a staging area.
  4. How do you initialize a new Git repository?
  5. How do you clone a repository?
  6. What does git add do?
  7. What does git commit do?
  8. What is the difference between git commit -m and git commit -a?
  9. What is the difference between git status and git log?
  10. Explain the difference between git fetch and git pull.
  11. What does git push do?
  12. How do you check the current Git configuration?
  13. How do you create a .gitignore file?
  14. How do you check the version of Git installed?
  15. What is the difference between a bare repository and a non-bare repository?
  16. How do you rename a Git branch locally?
  17. What does HEAD mean in Git?
  18. How do you delete a branch in Git locally?
  19. How do you delete a branch in Git remotely?
  20. How do you configure a global username and email in Git?

2. Branching & Merging

  1. What is a branch in Git?
  2. How do you create a branch in Git?
  3. How do you switch between branches?
  4. What is the difference between git checkout and git switch?
  5. How do you list all branches in Git?
  6. How do you rename a branch?
  7. How do you merge one branch into another?
  8. What is a fast-forward merge?
  9. What is a three-way merge?
  10. What are merge conflicts in Git?
  11. How do you resolve merge conflicts?
  12. What is the difference between merge and rebase?
  13. What does git cherry-pick do?
  14. How do you undo a merge?
  15. What is the difference between git reset and git revert?
  16. How do you create a tracking branch?
  17. What is the purpose of git branch -vv?
  18. What is a detached HEAD state?
  19. How do you move a commit from one branch to another?
  20. Explain GitFlow branching strategy.

3. Remote Repositories

  1. What is a remote in Git?
  2. How do you add a remote repository?
  3. How do you list all remotes in Git?
  4. How do you remove a remote repository?
  5. How do you rename a remote repository?
  6. What does origin mean in Git?
  7. How do you fetch changes from a remote without merging?
  8. What is the difference between git fetch and git pull?
  9. How do you push changes to a remote branch?
  10. How do you push a new local branch to a remote repository?
  11. How do you set a default remote branch for pushing?
  12. How do you track a remote branch locally?
  13. What is the purpose of git remote -v?
  14. How do you force push changes in Git?
  15. What are the risks of git push --force?
  16. How do you safely force push without overwriting others? changes?
  17. How do you delete a branch in a remote repository?
  18. How do you check if a branch exists in a remote repo?
  19. What is a fork in Git, and how is it different from a clone?
  20. How do you sync a fork with the upstream repository?

4. Staging, Stash & Clean

  1. What is the staging area in Git?
  2. How do you add files to the staging area?
  3. How do you remove files from the staging area?
  4. What does git diff do?
  5. What does git diff --staged show?
  6. How do you unstage a file?
  7. What is Git stash?
  8. How do you stash changes?
  9. How do you apply stashed changes?
  10. How do you list all stashes?
  11. How do you drop a stash?
  12. How do you clear all stashes?
  13. How do you apply a stash without removing it?
  14. How do you stash untracked files?
  15. What is the difference between git stash pop and git stash apply?
  16. What does git clean do?
  17. How do you remove untracked files in Git?
  18. How do you remove ignored files in Git?
  19. What is the difference between tracked and untracked files?
  20. How do you check which files are ignored in Git?

5. Undo & Recovery

  1. How do you undo the last commit?
  2. What does git reset do?
  3. Difference between git reset --soft, --mixed, and --hard.
  4. How do you revert a commit?
  5. What does git reflog do?
  6. How do you recover a deleted branch?
  7. How do you find a lost commit in Git?
  8. What is an orphan branch?
  9. How do you go back to a previous commit?
  10. What is the difference between git reset HEAD^ and git reset --hard HEAD^?
  11. How do you undo changes to a file before staging?
  12. How do you undo changes to a file after staging?
  13. How do you remove the last commit without deleting changes?
  14. How do you squash commits?
  15. How do you amend the last commit message?
  16. How do you move commits to another branch?
  17. How do you recover a commit after rebase?
  18. What is the difference between git checkout and git restore?
  19. How do you discard all local changes in Git?
  20. What is the difference between git reset and git checkout?

6. Git Internals

  1. Explain the Git object model.
  2. What are blobs, trees, and commits in Git?
  3. What is the purpose of SHA-1 in Git?
  4. Where does Git store its data?
  5. What is .git directory?
  6. What are Git references?
  7. What is HEAD in Git?
  8. What is a Git object hash?
  9. How does Git ensure data integrity?
  10. Explain the concept of Git snapshots vs diffs.
  11. What is the difference between Git index and working tree?
  12. What is a packed object in Git?
  13. What is git gc?
  14. What is the purpose of git fsck?
  15. How does Git compress objects?
  16. Explain Git pack files.
  17. What is git cat-file used for?
  18. What is git hash-object?
  19. How does Git handle large files?
  20. Explain Git internals vs Git commands.

7. Collaboration & Workflow

  1. What is a pull request?
  2. What is the difference between a pull request and a merge request?
  3. How do you create a pull request in GitHub?
  4. What is the purpose of code reviews in Git workflows?
  5. What is GitHub flow?
  6. What is GitLab flow?
  7. What is trunk-based development?
  8. Explain feature branching workflow.
  9. Explain release branching workflow.
  10. What is the GitFlow workflow?
  11. What is the difference between GitHub flow and GitFlow?
  12. What is a hotfix branch?
  13. What is a long-lived branch?
  14. What is the difference between main and master branch?
  15. How do you enforce branch protection rules?
  16. How do you enforce commit message guidelines?
  17. How do you squash commits in a pull request?
  18. How do you rebase a pull request?
  19. How do you resolve conflicts in a pull request?
  20. How do you maintain a clean Git history?

8. Advanced Commands & Techniques

  1. What does git bisect do?
  2. How do you use git bisect to find a bug?
  3. What does git blame do?
  4. How do you use git blame effectively?
  5. What does git shortlog do?
  6. What does git describe do?
  7. What does git rev-parse do?
  8. What does git show do?
  9. What does git archive do?
  10. What is git bundle?
  11. How do you split a commit into multiple commits?
  12. How do you combine multiple commits into one?
  13. How do you sign a commit with GPG?
  14. What does git verify-commit do?
  15. What does git verify-tag do?
  16. What does git notes do?
  17. What is the difference between git submodule and git subtree?
  18. How do you add a Git submodule?
  19. How do you update a Git submodule?
  20. How do you remove a Git submodule?

9. CI/CD Integration

  1. How do you integrate Git with Jenkins?
  2. What is GitHub Actions?
  3. How do you trigger a pipeline from a Git commit?
  4. What is the difference between webhooks and polling?
  5. How do you use Git in a Jenkins pipeline?
  6. How do you automate tests with GitHub Actions?
  7. How do you deploy code using GitLab CI?
  8. What is the difference between GitHub Actions and GitLab CI?
  9. How do you use Git tags in CI/CD pipelines?
  10. What is the role of Git in DevOps?
  11. How do you enforce code quality checks in Git workflows?
  12. How do you rollback a deployment using Git?
  13. How do you use Git in Kubernetes deployments?
  14. What is GitOps?
  15. How do you implement GitOps?
  16. What tools are used for GitOps?
  17. How do you automate semantic versioning with Git?
  18. How do you use Git for continuous delivery?
  19. What are GitHub Packages?
  20. What is the difference between GitHub Packages and Artifactory?

10. Security & Best Practices

  1. How do you sign commits in Git?
  2. What is the importance of signed commits?
  3. How do you verify a signed commit?
  4. How do you securely store Git credentials?
  5. What is the use of Git credential helper?
  6. How do you rotate Git credentials?
  7. What is the difference between HTTPS and SSH for Git?
  8. How do you enforce branch policies in GitHub?
  9. What is the principle of least privilege in Git access control?
  10. How do you prevent accidental force pushes?
  11. How do you prevent committing secrets to Git?
  12. What is Git-secrets tool?
  13. What is pre-commit hook?
  14. What is the difference between client-side and server-side hooks?
  15. How do you use Git hooks for code quality enforcement?
  16. How do you enforce commit message conventions?
  17. How do you maintain a clean commit history?
  18. How do you choose a branching strategy for a project?
  19. What are common Git anti-patterns?
  20. What are Git best practices for large teams?

Related Topics