Apply branch changes without merging with Git

Snippet

You're working in one branch and you want the changes from another branch (say, you've done a pull request, and want the changes made in that other branch in your current branch), but don't want to merge the changes, you just want them available.

Assuming you want them all in one go, merge without committing, with a squash, then unstage the staged files that will come over with the merge.

If you want specific changes, use git cherrypick -n

git merge --no-commit --squash branch_with_commits
git reset HEAD

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.