revert back on git but a merge but no -m option was given
Asked Answered
B

1

5

I have commit and push 2 change now i want to revert back one push from git

I have use this

sudo git revert 1c3268d4b69dc6ca9dd89e92b513f5edb194978c

but it show me

Commit 1c3268d4b69dc6ca9dd89e92b513f5edb194978c is a merge but no -m option was given

git log

commit b3972be60fb2f2c70b56f470c8327152e773f725
Author: jaskarans <[email protected]>
Date:   Fri Mar 16 11:25:49 2018 +0530

    remove error 1599

commit 1c3268d4b69dc6ca9dd89e92b513f5edb194978c
Merge: 5d6fdd4 7531be0
Author: jaskarans <[email protected]>
Date:   Fri Mar 16 10:23:58 2018 +0530

    Merge branch 'development' of https:// abc.com:8888/development/asdf into jQuery_update

commit 5d6fdd48cdd0b402913bf70fb64be83e676e8b21
Author: jaskarans <[email protected]>
Date:   Fri Mar 16 10:21:26 2018 +0530
Borges answered 16/3, 2018 at 6:27 Comment(0)
E
15

If your commit was of merge type, which you were trying to revert then you can not do it in SourceTree. Merge commits cannot be cherry-picked / reverted.

To revert merge commit you have to follow following syntax

git revert -m 1 <commit-hash> 
git commit -m "Reverting the last commit."
git push -u origin master
Emmanuelemmeline answered 16/3, 2018 at 6:49 Comment(4)
what is -m 1, What it is doing?Borges
It indicates that you'd like to revert to the tree of the first parent prior to the merge.Emmanuelemmeline
@nTri: that's not quite right, you're not reverting to anything ("revert to" would imply "take the tree of", which would discard operations made by commits subsequent to the merge; git revert does not do that).Spy
What does "first parent" mean? (Earliest CommitDate? Earliest AuthorDate? Something else?)Threeply

© 2022 - 2024 — McMap. All rights reserved.