Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created January 11, 2013 12:24
Show Gist options
  • Select an option

  • Save lukeredpath/4510308 to your computer and use it in GitHub Desktop.

Select an option

Save lukeredpath/4510308 to your computer and use it in GitHub Desktop.
State A (current):
branch foo: A -- B -- C -- D
\
branch bar: -- E -- F -- G --H
I want commit E from bar brought back into foo, without cherry-picking and creating a new commit. Essentially I want to go to this:
State B:
branch foo: A -- B -- C -- D -- E
\
branch bar: F -- G --H
@olly

olly commented Jan 11, 2013

Copy link
Copy Markdown

I think you could just do (from branch foo):

git reset --hard E

(where E is the sha reference to E)

This would point that branch at commit E. The history stays intact. This only won't work if you have further commits (not shown) on branch foo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment