LinuxCommandLibrary

git-graft

Merge branch and delete immediately

TLDR

Graft branch into history

$ git graft [branch]
copy
Graft onto specific commit
$ git graft [branch] [base-commit]
copy

SYNOPSIS

git graft branch [base]

DESCRIPTION

git graft merges a branch then immediately deletes it, combining git merge followed by git branch -d into a single operation. It is useful for incorporating completed feature branches into the main history while cleaning up branch clutter.
Part of the git-extras suite, the command simplifies the common merge-and-delete workflow for branches that should become part of history without keeping the branch reference.

PARAMETERS

BRANCH

Branch to graft.
BASE
Base commit (default: branch point).
--help
Display help information.

CAVEATS

Part of git-extras package. Branch deleted after merge. Use for completed work only.

HISTORY

git graft is part of git-extras, providing a convenience wrapper for the common merge-then-delete pattern.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community