Version Control & Hosting
Git itself plus the platforms built around it — GitHub, GitLab, Bitbucket — where repositories, code review, CI, packages and cloud dev environments live. Interviewers use this area constantly because every job involves a branching model, a review process, and a pipeline attached to a push.
on this pageshowhide
explore
- Git (has its own guide)245 questions
- Object Model and DAG27 questions
- Staging and Commits18 questions
- Branching and Merging26 questions
- Rebase and History Rewriting32 questions
- Remotes and Collaboration35 questions
- Stash, Reflog, and Recovery20 questions
- Inspecting History16 questions
- Hooks13 questions
- Submodules, Subtrees, and Worktrees13 questions
- Branching Workflows20 questions
- Configuration, Ignore Rules, and Attributes25 questions
- Git LFS11 questions
- Tracking and Pointer Files5 questions
- LFS Storage and Operations6 questions
- GitHub (has its own guide)77 questions
- Repositories and PR Workflow29 questions
- Code Review6 questions
- GitHub Actions4 questions
- Issues and Projects6 questions
- Releases and Packages5 questions
- Security Features21 questions
- API, Apps, and Webhooks6 questions
- GitLab34 questions
- Repositories and Merge Requests6 questions
- CI/CD Pipelines6 questions
- Hosted Runners and Fleet4 questions
- Registries and Packages6 questions
- Security Scanning6 questions
- Self-Managed vs SaaS6 questions
- Bitbucket12 questions
- Repositories and Pull Requests6 questions
- Bitbucket Pipelines6 questions
- GitHub CLI17 questions
- Authentication and Configuration6 questions
- PR, Issue, and Release Commands5 questions
- gh api and Scripting6 questions
- GitHub Codespaces12 questions
- Devcontainer Configuration6 questions
- Codespace Lifecycle and Cost6 questions
- GitHub Packages11 questions
- Registries and Authentication5 questions
- Package Visibility and Retention6 questions
- Blockchain Developerrole anchor
- DevOps / SRE Engineerrole anchor
- AI & Data Scientistrole
- AI Engineerrole
- AI Red Teamingrole
- Android Developerrole
- BI Analystrole
- Backend Developerrole
- Data Analystrole
- Data Engineerrole
- DevSecOps Engineerrole
- Forward Deployed Engineerrole
- Frontend Developerrole
- Full Stack Developerrole
- Game Developerrole
- Git & GitHubtool
- GitLab CI/CDtool
- JS Full Stack Developerrole
- Java Backend Developerrole
- Java SDETrole
- Kotlin Backend Developerrole
- MLOps Engineerrole
- Machine Learning Engineerrole
- Network Engineerrole
- PostgreSQL DBArole
- QA Engineerrole
- Server-Side Game Developerrole
- Software Architectrole
- Vibe Codingskill
- iOS Developerrole
questions
419 · 8 sectionsIn Git, what does creating a branch with git branch feature actually do?
basics
~20 sIt writes one new ref holding the hash of the commit you branched from. No files are copied and no history is duplicated, which is why branching is instant in a repository of any size.
In Git, what do the <<<<<<<, =======, and >>>>>>> markers in a conflicted file mean?
basics
~20 sGit writes both versions of a region it could not merge into the file. Text between <<<<<<< and ======= is the side you are on; text between ======= and >>>>>>> is the incoming side. You edit the file to the final content, delete the markers, and stage it.
In Git, what is a fast-forward merge and when can Git perform one?
basics
~20 sA fast-forward merge happens when the current branch's commit is already an ancestor of the commit being merged. Git records no merge commit; it simply moves the branch pointer forward and updates the index and working tree.
In Git, what is a three-way merge and which three commits does it use?
basics
~20 sA three-way merge combines two branch tips using their best common ancestor, the merge base, as a reference point. Comparing each tip against that base tells Git which side changed what, so it can combine changes instead of guessing.
In Git, how do the --system, --global and --local config scopes differ, and which one wins?
basics
~10 sThey name three config files: machine-wide, per-user, and per-repository. Git reads them in that order and the narrower scope wins, so a repository's .git/config overrides your home-directory settings, which override the system file.
With Git LFS, what does a commit actually store for a tracked 300 MB PSD file, and where do the real bytes live?
basics
~20 sA Git LFS commit stores a small text pointer holding a spec version, the file's SHA-256 oid and its size; the real bytes sit in the local LFS cache and on the LFS server, swapped in at checkout.
With Git LFS, how do you stop a CI job that clones the repository from downloading binaries no build step opens?
basics
~20 sSet GIT_LFS_SKIP_SMUDGE=1 before cloning so checkout leaves pointer files instead of downloading content, then run git lfs pull with --include for only the paths the build reads. A shallow clone does not reduce LFS downloads.
With Git LFS, why does running `git lfs track "*.psd"` after a year of committing PSDs straight into Git leave clones just as large?
basics
~20 sTracking only changes how content is cleaned from now on; every PSD committed during that year is still a full blob reachable from history. Shrinking clones needs git lfs migrate import over all refs, which rewrites history.
With Git LFS, how do git lfs fetch, git lfs checkout and git lfs pull differ?
basics
~20 sgit lfs fetch downloads objects into the local LFS store without touching the working copy; git lfs checkout writes content from that store over pointer files without downloading; git lfs pull does both, like fetch followed by checkout.
With Git LFS, what do `git lfs install` and `git lfs track "*.psd"` each set up, and what does the resulting .gitattributes line mean?
basics
~20 sgit lfs install configures the lfs clean, smudge and process filters (globally by default) and installs Git LFS's hooks; git lfs track writes a filter=lfs diff=lfs merge=lfs -text line into .gitattributes, which must be committed.
What is GitHub Actions, and where in a repository must a workflow file live to be run?
basics
~10 sGitHub Actions is GitHub's built-in automation and CI/CD system. A workflow is a YAML file in the repository's .github/workflows directory that declares the events triggering it and the jobs to run when one occurs.
In GitHub, what happens when you push straight to main if a rule requires a pull request?
basics
~20 sGitHub's server refuses the push. The remote rejects the ref update with a protected-branch error, nothing lands on main, and your local commits are untouched — you push a topic branch and open a pull request instead.
On a GitHub pull request, what is the difference between Approve, Request changes, and Comment?
basics
~20 sApprove endorses the pull request and counts toward any required approvals. Request changes records a blocking objection that stays until the reviewer approves or the review is dismissed. Comment leaves feedback with no verdict either way.
In GitHub, what is a Dependabot alert and where does its data come from?
basics
~20 sA Dependabot alert is GitHub telling you that a package your repository depends on has a known vulnerability. It comes from matching the repository's dependency graph, built from committed manifests and lockfiles, against the GitHub Advisory Database.
In GitHub, how do you make a merged pull request close an issue automatically?
basics
~20 sPut a closing keyword and the issue number, such as "Fixes #123", in the pull request description or in a commit message. When that pull request merges into the repository's default branch, GitHub closes the linked issue.
In GitLab, where does a project's pipeline configuration come from, and what runs when the repository has no .gitlab-ci.yml?
basics
~20 sGitLab reads .gitlab-ci.yml from the repository root unless the project's CI/CD configuration file setting names another path, another project's file or a .yml URL. With no file, only Auto DevOps can run, if enabled and it finds a Dockerfile or buildpack.
In GitLab, when a CI/CD job pushes an image to its project's container registry, which predefined variables supply the address and the credentials?
basics
~10 sCI_REGISTRY is the registry host, CI_REGISTRY_IMAGE is the project's image path under it, and CI_REGISTRY_USER with CI_REGISTRY_PASSWORD log the job in; that password equals CI_JOB_TOKEN and is valid only while the job runs.
On GitLab.com, where does an untagged CI job run by default, and what is left of its machine when the next job starts?
basics
~20 sOn GitLab.com an untagged job runs on the GitLab-hosted small Linux x86-64 runner, in a newly provisioned VM dedicated to that job and deleted when it ends, so nothing on that machine reaches the next job.
In a GitLab merge request, what does the security scan report show, and why is a vulnerability already on main missing from it?
basics
~20 sIt shows what merging would change: findings the source branch adds and findings it fixes, compared against the target branch's security reports. A vulnerability present on both branches is unchanged by the merge, so the report leaves it out.
In GitLab, how do GitLab.com, Self-Managed and Dedicated differ, and which fits code that must stay in your own data centre?
basics
~20 sGitLab.com is GitLab's shared multi-tenant SaaS, GitLab Dedicated is a single-tenant instance GitLab hosts and runs for you, and GitLab Self-Managed is the same product you install and operate. Only Self-Managed can sit in your own data centre.
In Bitbucket Pipelines, what does each step run in, and why is a file built in one step missing in the next?
basics
~20 sEach Bitbucket Pipelines step starts a separate Docker container from its image with a fresh clone, so nothing on disk survives the step. Files a later step needs must be declared as artifacts; caches only restore downloaded dependencies.
In Bitbucket Pipelines, how do you make the production deployment step wait for a person, and what actually limits who can run it?
basics
~20 sGive the Bitbucket Pipelines step deployment: production and trigger: manual, so the pipeline pauses until someone promotes it. The pause alone lets anyone with write access deploy; on Premium, deployment permissions restrict each environment to admins or named users and groups.
In Bitbucket Cloud, why can a developer merge a pull request with one approval when main's merge check requires two?
basics
~20 sBitbucket Cloud merge checks only warn unless the workspace is on Premium and the restriction selects Prevent a merge with unresolved merge checks. Without that, the merge checklist shows the missing approval but anyone with merge access can still merge.
In Bitbucket Cloud linked to Jira, why might a commit message like ACME-142 #resolve leave the Jira work item unchanged?
basics
~20 sA Bitbucket Cloud smart commit runs as the Jira user whose email matches the commit's author email. A mismatched email, missing permission, required transition fields, a malformed key or disabled smart commits stops it; the commit still lands.
In Bitbucket Cloud, how do workspaces, projects and repositories relate, and where can access to a repository be granted?
basics
~20 sA Bitbucket Cloud workspace owns the repositories, members and user groups; projects group repositories inside it. Access is granted at three levels: workspace user groups, project permissions covering every repository in the project, and permissions on one repository.
With the GitHub CLI, what does gh api handle for you that a hand-written curl call to the GitHub API does not?
basics
~20 sgh api reuses gh's own credentials, resolves the host and API prefix, fills {owner} and {repo} from the current repository, builds JSON bodies, follows pages, filters with built-in jq and exits non-zero when the API returns an error.
With the GitHub CLI, how do you authenticate gh on your own laptop compared with inside a CI job?
basics
~20 sOn a laptop, gh auth login runs a browser flow with a one-time code and keeps the token in the system credential store. In CI, set GH_TOKEN in the job's environment; gh prefers it to any stored login and never prompts.
With the GitHub CLI, what does `gh pr checkout 482` do in your local clone, including when the pull request comes from a fork?
basics
~20 sgh pr checkout fetches the pull request's head and checks it out as a local branch named after the head branch, set up to track it; for a fork with no remote it fetches refs/pull/482/head from the base repository instead.
With the GitHub CLI's gh api, how do -f/--raw-field and -F/--field differ, and when does adding them change the HTTP method?
basics
~20 s-f always sends a string; -F converts true, false, null and integers to JSON types, fills {owner}/{repo}/{branch} and reads @file. Adding either switches gh api from GET to POST unless --method is given; --method GET sends them as a query string.
With the GitHub CLI, how do you find out from the terminal why last night's scheduled workflow run failed, and rerun only what broke?
basics
~20 sFind the run with gh run list filtered by workflow, event and status, read only the failing steps with gh run view <id> --log-failed, then gh run rerun <id> --failed and follow it with gh run watch <id> --exit-status.
In GitHub Codespaces, where can a repository's devcontainer.json live, and what does a codespace use when there is none?
basics
~10 sCodespaces reads .devcontainer/devcontainer.json or a root-level .devcontainer.json, plus alternatives at .devcontainer/NAME/devcontainer.json chosen at creation. With no configuration, it uses a default Linux image with common runtimes and tools.
In GitHub Codespaces, why does a codespace stop on its own, and what does it still cost once stopped?
basics
~20 sA codespace stops after an idle timeout: 30 minutes by default, settable from 5 to 240. Once stopped it no longer bills compute but keeps billing storage until deleted, which happens automatically after the retention period, 30 days by default.
In a GitHub Codespaces devcontainer.json, in what order do the lifecycle commands run, and which should install the project's dependencies?
basics
~10 sonCreateCommand, updateContentCommand and postCreateCommand finish setup once; postStartCommand runs at every start and postAttachCommand at every attach. Source-dependent installs belong in updateContentCommand, which the editor waits for by default.
In a GitHub Codespaces devcontainer.json, which properties give new contributors the team's extensions, a big enough machine and a prompt for their API key?
basics
~10 scustomizations.vscode sets extensions and editor settings, hostRequirements hides machine types below a minimum, and a top-level secrets object prompts creators for recommended personal secrets; customizations.codespaces adds openFiles and extra repository permissions.
In a GitHub Codespaces devcontainer.json, what are dev container features, and how do they differ from installing tools in a lifecycle command?
basics
~20 sFeatures are versioned, shareable install units referenced by ID in the features object. Their scripts run as root during the image build, each as a cached layer, whereas lifecycle commands run later inside the started container.
In GitHub Packages, what visibility can a package have, and what changes once you make a container image public?
basics
~10 sA GitHub Packages package is private, internal or public, and an account-scoped package starts private. Making it public cannot be undone, and a public container image can then be pulled anonymously by anyone.
In GitHub Packages, what is the Container registry at ghcr.io, and how do you log the Docker client in to push an image there?
basics
~20 sghcr.io is the GitHub Packages registry for Docker and OCI images, scoped to a user or organisation. Log in with docker login ghcr.io using a classic personal access token with write:packages, or GITHUB_TOKEN with packages: write inside a workflow.
In GitHub Packages, how do granular package permissions differ from repository-scoped ones, and when does a package inherit its linked repository's access?
basics
~20 sContainer, npm, NuGet and RubyGems packages belong to an account and can carry their own Read, Write and Admin roles; Maven and Gradle packages always follow their repository. A linked package inherits repository access until you remove that inheritance.
In GitHub Packages, why can a workflow pushing to ghcr.io with GITHUB_TOKEN and packages: write still be denied, and how does org.opencontainers.image.source help?
basics
~20 sGITHUB_TOKEN can only push to packages its repository may write, and an image first pushed from the command line is not linked to any repository; setting the org.opencontainers.image.source label before publishing links the image so the workflow's repository gets access.
In GitHub Packages, how does Maven find the token for maven.pkg.github.com, and why must the repository id match a settings.xml server id?
basics
~10 sMaven sends credentials only for a repository whose id matches a server id in ~/.m2/settings.xml; that server holds the GitHub username and a classic token, and the repository URL is https://maven.pkg.github.com/OWNER/REPOSITORY.