Basic Git Questions:
- What is Git?
- Explain the purpose of version control and Git’s role in it.
- What is the difference between Git and GitHub?
- How is Git different from GitHub or other hosting platforms like GitLab, Bitbucket, etc.?
- What are the main features of Git?
- Mention features like branching, version control, distributed nature, and more.
- Explain the Git workflow.
- Working directory, staging area, and local repository.
- What are the basic Git commands?
- Commands like git init, git add, git commit, git push, and git pull.
- What is a Git repository?
- Differentiate between local and remote repositories.
- What is the staging area in Git?
- Describe how git add works and its role in version control.
- What is the difference between git clone and git fork?
- Explain how cloning duplicates the repository while forking copies it into your own GitHub account.
- How do you create a new branch in Git?
- Explain git branch <branch_name> and git checkout -b <branch_name>.
- What is git merge?
- How does it merge branches, and what is a “fast-forward” merge?
Advanced Git Questions:
- What is git rebase, and how does it differ from git merge?
- Explain both, and discuss scenarios where rebasing is better suited.
- What is a git stash?
- How can you use git stash to temporarily save changes without committing?
- What is the difference between git fetch and git pull?
- Describe how git fetch only updates local metadata while git pull also integrates the changes.
- What are git cherry-pick and git revert?
- How do you selectively apply or undo commits?
- What is a “detached HEAD” state in Git?
- Discuss how this happens and how to resolve it.
- How can you undo the last commit?
- Explain git reset –soft HEAD~1 and git revert.
- What is the purpose of .gitignore?
- Explain how to use this file to prevent unwanted files from being committed.
- How do you resolve merge conflicts in Git?
- Describe the process of conflict resolution and tools that can help (e.g., git mergetool).
- What is Git submodule?
- Describe how you can include another repository inside your project and manage dependencies.
- What is git bisect, and how does it help in debugging?
- Explain how git bisect is used to perform a binary search to identify the commit that introduced a bug.
GitHub-Specific Questions:
- How does GitHub handle collaboration?
- Discuss pull requests, issues, and code reviews.
- What are GitHub Actions?
- Explain CI/CD workflows within GitHub.
- What is a GitHub Fork, and when would you use it?
- How does forking help when contributing to open-source projects?
- What is a Pull Request, and how is it different from pushing code?
- Discuss how pull requests facilitate code reviews and collaboration in GitHub.
- What are tags in Git and GitHub?
- Explain how tags are used for marking releases and important versions.
- What are GitHub repositories’ permissions?
- Explain the difference between owner, collaborator, and other roles.
- How can you secure a GitHub repository?
- Mention strategies like two-factor authentication, branch protection rules, and limiting write access.
- How do you squash commits in Git/GitHub?
- Explain squashing commits into one using git rebase -i and why this might be useful.
- How do you link a local Git repository with a remote repository on GitHub?
- Describe git remote add origin <repository_URL> and git push.
- What is the difference between public and private repositories in GitHub?
- Discuss visibility and accessibility between the two.
These questions span across basic and advanced concepts, providing a solid foundation for Git and GitHub knowledge in an interview.
For Cloud and Devops placement call 9666019191