How do you create, switch, and delete branches?
Use `git branch` to list or create branches and `git switch` to move between them. Delete a merged local branch with `-d`; `-D` force-deletes and…
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 1657–1668 of 3610 questions
Use `git branch` to list or create branches and `git switch` to move between them. Delete a merged local branch with `-d`; `-D` force-deletes and…
Detached HEAD means `HEAD` points directly to a commit rather than a branch name. It is useful for inspecting old revisions, but new commits can…
Merge integrates histories by creating a merge commit when needed, or by fast-forwarding when the target can move directly forward. Conflicts occ…
A fast-forward occurs when the target branch is an ancestor of the source branch, so Git can move the target reference forward without creating a…
When branches diverge, Git uses their common ancestor and both branch tips to calculate a merge result. Conflicting edits to the same region may…
A conflict means Git cannot determine the intended combined content. Inspect conflict markers, understand both changes, edit the file to the corr…
Rebase replays commits onto a new base, producing a more linear history. Replayed commits have new IDs. Rebase local unpublished work freely, but…
Merge preserves the actual integration topology and is suitable for shared history. Rebase creates a linear sequence and is useful for cleaning u…
`git cherry-pick` applies the changes introduced by selected commit(s) onto the current branch, creating new commit IDs. It is useful for targete…
Stash temporarily saves working-tree and optionally staged changes so you can switch context without committing incomplete work. Stashes are loca…
The right command depends on whether the commit is shared and whether you want to keep its changes. `git revert` creates a new inverse commit; `g…
`reset` moves the current branch/HEAD and can alter the index or working tree; `revert` records a new commit that reverses an earlier commit; `re…