Git - mark files as unmerged





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have following situation:



I have something like main branch in my project(green color in the picture).



My workmate has create his own branch (red color) and pushed his commit.



Unfortunately before one of the pushes he merged his red branch with green branch discarding all changes which i had pushed in the meantime (R2 on the picture). After that he made some another pushes (R3 and R4).



Currently, i am in G2 and i want to merge my green branch with red branch, but unfortunately all changes between G1 and G2 are skipped when i merge this two branches because git sees this changes as merged.



So my question is how to mark my changes beetween G1 and G2 as unmerged with red branch or at least how to see all differences between this two branches to be able to merge manually?? Nice to see another proposals.



enter image description here










share|improve this question























  • Perhaps revert the Bad commit?

    – Christoph
    Nov 22 '18 at 9:48











  • Will it "unmerge" files or only delete changes added between R1 and R2?

    – borneo777
    Nov 22 '18 at 9:52











  • Its not clear what you want out of this. You can't unmerge. It's not a thing. so forget about that and concentrate on what you can do to achive whatever it is you want the outcome to be. I think, though the question really isn't clear, your going to have to cherry pick G1 and G2 onto the end of the red branch. What exactly is a "bad merge" anyway?

    – Liam
    Nov 22 '18 at 9:54








  • 1





    What the "bad merge" is? (explanation) My workmate was in R1 -> he merged with my green branch discarding all my changes -> he added his own changes -> he commited and pushed

    – borneo777
    Nov 22 '18 at 9:58











  • and you've told him how stupid his actions are I'm hoping?! So there's nothing bad about the merge. As far as GIT is concerned it's just a merge. To undo it would require re-writing the history, which is not an easy task. If it we're me I'd create a new branch at R1 (or G1 or even G2) and cheery pick each commit into it again and merge as you see it. Then discard both the red and Green branches

    – Liam
    Nov 22 '18 at 10:55




















0















I have following situation:



I have something like main branch in my project(green color in the picture).



My workmate has create his own branch (red color) and pushed his commit.



Unfortunately before one of the pushes he merged his red branch with green branch discarding all changes which i had pushed in the meantime (R2 on the picture). After that he made some another pushes (R3 and R4).



Currently, i am in G2 and i want to merge my green branch with red branch, but unfortunately all changes between G1 and G2 are skipped when i merge this two branches because git sees this changes as merged.



So my question is how to mark my changes beetween G1 and G2 as unmerged with red branch or at least how to see all differences between this two branches to be able to merge manually?? Nice to see another proposals.



enter image description here










share|improve this question























  • Perhaps revert the Bad commit?

    – Christoph
    Nov 22 '18 at 9:48











  • Will it "unmerge" files or only delete changes added between R1 and R2?

    – borneo777
    Nov 22 '18 at 9:52











  • Its not clear what you want out of this. You can't unmerge. It's not a thing. so forget about that and concentrate on what you can do to achive whatever it is you want the outcome to be. I think, though the question really isn't clear, your going to have to cherry pick G1 and G2 onto the end of the red branch. What exactly is a "bad merge" anyway?

    – Liam
    Nov 22 '18 at 9:54








  • 1





    What the "bad merge" is? (explanation) My workmate was in R1 -> he merged with my green branch discarding all my changes -> he added his own changes -> he commited and pushed

    – borneo777
    Nov 22 '18 at 9:58











  • and you've told him how stupid his actions are I'm hoping?! So there's nothing bad about the merge. As far as GIT is concerned it's just a merge. To undo it would require re-writing the history, which is not an easy task. If it we're me I'd create a new branch at R1 (or G1 or even G2) and cheery pick each commit into it again and merge as you see it. Then discard both the red and Green branches

    – Liam
    Nov 22 '18 at 10:55
















0












0








0








I have following situation:



I have something like main branch in my project(green color in the picture).



My workmate has create his own branch (red color) and pushed his commit.



Unfortunately before one of the pushes he merged his red branch with green branch discarding all changes which i had pushed in the meantime (R2 on the picture). After that he made some another pushes (R3 and R4).



Currently, i am in G2 and i want to merge my green branch with red branch, but unfortunately all changes between G1 and G2 are skipped when i merge this two branches because git sees this changes as merged.



So my question is how to mark my changes beetween G1 and G2 as unmerged with red branch or at least how to see all differences between this two branches to be able to merge manually?? Nice to see another proposals.



enter image description here










share|improve this question














I have following situation:



I have something like main branch in my project(green color in the picture).



My workmate has create his own branch (red color) and pushed his commit.



Unfortunately before one of the pushes he merged his red branch with green branch discarding all changes which i had pushed in the meantime (R2 on the picture). After that he made some another pushes (R3 and R4).



Currently, i am in G2 and i want to merge my green branch with red branch, but unfortunately all changes between G1 and G2 are skipped when i merge this two branches because git sees this changes as merged.



So my question is how to mark my changes beetween G1 and G2 as unmerged with red branch or at least how to see all differences between this two branches to be able to merge manually?? Nice to see another proposals.



enter image description here







git git-branch git-merge






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 9:44









borneo777borneo777

75110




75110













  • Perhaps revert the Bad commit?

    – Christoph
    Nov 22 '18 at 9:48











  • Will it "unmerge" files or only delete changes added between R1 and R2?

    – borneo777
    Nov 22 '18 at 9:52











  • Its not clear what you want out of this. You can't unmerge. It's not a thing. so forget about that and concentrate on what you can do to achive whatever it is you want the outcome to be. I think, though the question really isn't clear, your going to have to cherry pick G1 and G2 onto the end of the red branch. What exactly is a "bad merge" anyway?

    – Liam
    Nov 22 '18 at 9:54








  • 1





    What the "bad merge" is? (explanation) My workmate was in R1 -> he merged with my green branch discarding all my changes -> he added his own changes -> he commited and pushed

    – borneo777
    Nov 22 '18 at 9:58











  • and you've told him how stupid his actions are I'm hoping?! So there's nothing bad about the merge. As far as GIT is concerned it's just a merge. To undo it would require re-writing the history, which is not an easy task. If it we're me I'd create a new branch at R1 (or G1 or even G2) and cheery pick each commit into it again and merge as you see it. Then discard both the red and Green branches

    – Liam
    Nov 22 '18 at 10:55





















  • Perhaps revert the Bad commit?

    – Christoph
    Nov 22 '18 at 9:48











  • Will it "unmerge" files or only delete changes added between R1 and R2?

    – borneo777
    Nov 22 '18 at 9:52











  • Its not clear what you want out of this. You can't unmerge. It's not a thing. so forget about that and concentrate on what you can do to achive whatever it is you want the outcome to be. I think, though the question really isn't clear, your going to have to cherry pick G1 and G2 onto the end of the red branch. What exactly is a "bad merge" anyway?

    – Liam
    Nov 22 '18 at 9:54








  • 1





    What the "bad merge" is? (explanation) My workmate was in R1 -> he merged with my green branch discarding all my changes -> he added his own changes -> he commited and pushed

    – borneo777
    Nov 22 '18 at 9:58











  • and you've told him how stupid his actions are I'm hoping?! So there's nothing bad about the merge. As far as GIT is concerned it's just a merge. To undo it would require re-writing the history, which is not an easy task. If it we're me I'd create a new branch at R1 (or G1 or even G2) and cheery pick each commit into it again and merge as you see it. Then discard both the red and Green branches

    – Liam
    Nov 22 '18 at 10:55



















Perhaps revert the Bad commit?

– Christoph
Nov 22 '18 at 9:48





Perhaps revert the Bad commit?

– Christoph
Nov 22 '18 at 9:48













Will it "unmerge" files or only delete changes added between R1 and R2?

– borneo777
Nov 22 '18 at 9:52





Will it "unmerge" files or only delete changes added between R1 and R2?

– borneo777
Nov 22 '18 at 9:52













Its not clear what you want out of this. You can't unmerge. It's not a thing. so forget about that and concentrate on what you can do to achive whatever it is you want the outcome to be. I think, though the question really isn't clear, your going to have to cherry pick G1 and G2 onto the end of the red branch. What exactly is a "bad merge" anyway?

– Liam
Nov 22 '18 at 9:54







Its not clear what you want out of this. You can't unmerge. It's not a thing. so forget about that and concentrate on what you can do to achive whatever it is you want the outcome to be. I think, though the question really isn't clear, your going to have to cherry pick G1 and G2 onto the end of the red branch. What exactly is a "bad merge" anyway?

– Liam
Nov 22 '18 at 9:54






1




1





What the "bad merge" is? (explanation) My workmate was in R1 -> he merged with my green branch discarding all my changes -> he added his own changes -> he commited and pushed

– borneo777
Nov 22 '18 at 9:58





What the "bad merge" is? (explanation) My workmate was in R1 -> he merged with my green branch discarding all my changes -> he added his own changes -> he commited and pushed

– borneo777
Nov 22 '18 at 9:58













and you've told him how stupid his actions are I'm hoping?! So there's nothing bad about the merge. As far as GIT is concerned it's just a merge. To undo it would require re-writing the history, which is not an easy task. If it we're me I'd create a new branch at R1 (or G1 or even G2) and cheery pick each commit into it again and merge as you see it. Then discard both the red and Green branches

– Liam
Nov 22 '18 at 10:55







and you've told him how stupid his actions are I'm hoping?! So there's nothing bad about the merge. As far as GIT is concerned it's just a merge. To undo it would require re-writing the history, which is not an easy task. If it we're me I'd create a new branch at R1 (or G1 or even G2) and cheery pick each commit into it again and merge as you see it. Then discard both the red and Green branches

– Liam
Nov 22 '18 at 10:55














1 Answer
1






active

oldest

votes


















0














"mark as unmerged"? That, you won't be able to do moving forward. If you are willing to go the best possible way (correct history) I would say you checkout R1 and merge G2 correctly (or the other way around, it would be the same output). Then you could cherry-pick R2..R4 and then you have a nice new history with the right merge. If you don't want to overwrite history, you might checkout G2 and git merge --no-commit R4 so that you have a chance to get your stuff back before committing.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427983%2fgit-mark-files-as-unmerged%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    "mark as unmerged"? That, you won't be able to do moving forward. If you are willing to go the best possible way (correct history) I would say you checkout R1 and merge G2 correctly (or the other way around, it would be the same output). Then you could cherry-pick R2..R4 and then you have a nice new history with the right merge. If you don't want to overwrite history, you might checkout G2 and git merge --no-commit R4 so that you have a chance to get your stuff back before committing.






    share|improve this answer




























      0














      "mark as unmerged"? That, you won't be able to do moving forward. If you are willing to go the best possible way (correct history) I would say you checkout R1 and merge G2 correctly (or the other way around, it would be the same output). Then you could cherry-pick R2..R4 and then you have a nice new history with the right merge. If you don't want to overwrite history, you might checkout G2 and git merge --no-commit R4 so that you have a chance to get your stuff back before committing.






      share|improve this answer


























        0












        0








        0







        "mark as unmerged"? That, you won't be able to do moving forward. If you are willing to go the best possible way (correct history) I would say you checkout R1 and merge G2 correctly (or the other way around, it would be the same output). Then you could cherry-pick R2..R4 and then you have a nice new history with the right merge. If you don't want to overwrite history, you might checkout G2 and git merge --no-commit R4 so that you have a chance to get your stuff back before committing.






        share|improve this answer













        "mark as unmerged"? That, you won't be able to do moving forward. If you are willing to go the best possible way (correct history) I would say you checkout R1 and merge G2 correctly (or the other way around, it would be the same output). Then you could cherry-pick R2..R4 and then you have a nice new history with the right merge. If you don't want to overwrite history, you might checkout G2 and git merge --no-commit R4 so that you have a chance to get your stuff back before committing.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 '18 at 9:50









        eftshift0eftshift0

        5,8071021




        5,8071021
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427983%2fgit-mark-files-as-unmerged%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?