git-merge-into
Merge one branch into another, locally
TLDR
Merge a source branch into a specific destination branch
Merge current branch into a specific destination branch
SYNOPSIS
git-merge-into [options] <target-branch> [<source-branch>]
PARAMETERS
--delete-source, -d
Delete the source branch after successful merge
--no-ff, -f
Create a merge commit even if fast-forward is possible
--no-push, -P
Skip pushing the target branch to remote after merge
--preview, -p
Preview the merge without applying changes
--rebase, -r
Rebase source onto target instead of merging
--message="MSG", -m "MSG"
Custom merge commit message
DESCRIPTION
git-merge-into is a utility command from the popular git-extras extension for Git. It streamlines the process of integrating changes from a source branch (typically the current one) into a specified target branch, such as main or develop.
The workflow is: it stashes any uncommitted changes, switches to the target branch, performs the merge (or rebase if specified), pushes the updated target branch to the remote (unless disabled), switches back to the original branch, and restores the stash if applicable. This is ideal for feature branch development where quick integration and cleanup are needed.
It supports previews to avoid surprises and handles common scenarios like fast-forward merges or forced commits. Unlike plain git merge, it automates branch switching and pushing, reducing manual steps and errors in team environments.
Usage shines in CI/CD pipelines or daily development to keep long-lived branches updated without disrupting your flow.
CAVEATS
Requires git-extras installed; not core Git. Assumes no unresolvable conflicts; aborts on dirty tree unless stashed. Pushing requires configured upstream.
INSTALLATION
Install git-extras via apt install git-extras, brew install git-extras, or git clone https://github.com/tj/git-extras.git and run make install.
PREREQUISITES
Target branch must exist locally/remote. Source branch tracked upstream for push safety. Use --preview first in shared repos.
HISTORY
Introduced in git-extras by TJ Holowaychuk in 2011. Evolved with options like rebase and preview in later versions (e.g., v4+). Widely used by over 10k developers via GitHub stars.
SEE ALSO
git-merge(1), git-push(1), git-switch(1), git-stash(1)


