Any way help to revert part of a histroy commit in git? -


Suppose I do the history in the GIT repository below (all the changes have been made on a file) < Ol>

  • Delete function foo () and bar () , function baz ()
  • something else Change

    Now I want to add back the function foo () that I want to interact manually in order to do this. For example, an editor is opened in Side-by-Side Def mode. On one hand, the first version of the committed # 1 (in which the function is foo () ), on the other hand is my local working copy so that I can copy anything from history to copy copy of the work.

    Can any git command help me to do this?

    Thank you

    This is a solution that I would probably like to do: Hide any existing modifications to be safe # Git hiding place # commit a new one that again adds foo, bar and maj gith Back & amp; Committed to your work & amp; ShA; # Remove what you've committed, but leave the file changes. Reset Git HEAD ^ # interactively decide what you really want. # Follow the instructions, type '?' For help. Git add -p # Submit all the changes that you did Git commit # Leave all the other things that you have not accepted. GIT checkout

  • Comments