Accidentally pulling remote branch B to local branch A,
Pushed to remote branch A.

[I want to solve]
Commit content for remote branch B fetched from remote branch A by push
I want to remove it.
In addition, because we are proceeding with renovation after accidentally pulling,
If possible, keep the contents of the current remote branch A
I want to remove only the commit for B minutes. .

If i looked at it yourself,
Return remote repository A to the state it was in before pulling it,
I feel that the best way is to take in the contents of the refurbishment after pulling one by one with cherry-pick. .
If i am an expert and know more efficient ways, it would be helpful if you could teach me.
(* I would also be glad if you provided guidance on branch strategy, etc.)

  • Answer # 1

    If you just want to undo a file change, use therevertcommand.

    revert does not delete the commit itself, but creates a new commit that cancels the target commit.
    Therefore, please note that the commit log itself cannot be clean.

    Use therebasecommand and the-ioption if you want to make it beautiful.

    Please be careful when working, as it will not be clean and refreshing.


    (* I would also be happy if you also provided guidance on branch strategy, etc.)

    As for

    , there is no information on the current branch strategy etc., so I can not advise you.
    It is better to refer toGit flow,GitHub flow.