Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Are there good techniques when manually merging code ?

Are there good techniques when manually merging code ?

Scheduled Pinned Locked Moved The Lounge
databasedevopsquestion
22 Posts 13 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Maximilien

    Or just hope for the best or just re-write everything from scratch with the 2 versions on different screens for reference ? I added a new feature in my developement branch as part of some bigger changes (database) , I needed to backport it to main branch, and I improved it on the main branch. Now I have to merge it back to the development branch. lolz... :rolleyes: I just hope it compiles at this point and start fixing it !!

    CI/CD = Continuous Impediment/Continuous Despair

    C Offline
    C Offline
    charlieg
    wrote on last edited by
    #7

    If you are comparing code - I strongly STRONGLY recommend Beyond Compare. My coworker, mentor, boss sent me in this direction, and I never looked back. As far as the general process - full disclaimer I use SVN and Tortoise, so I cannot speak to what GIT does - doing a large merge should be off in a branch. Once you are done and happy, you can migrate it to the trunk. Using this approach, you have a retreat path. Feel free to do as many commits as you want on the branch to show your merge work. Better yet, have developer 1 and 2 commit their work on separate branches and merge those. Protect the trunk.

    Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

    J S 2 Replies Last reply
    0
    • M Maximilien

      Or just hope for the best or just re-write everything from scratch with the 2 versions on different screens for reference ? I added a new feature in my developement branch as part of some bigger changes (database) , I needed to backport it to main branch, and I improved it on the main branch. Now I have to merge it back to the development branch. lolz... :rolleyes: I just hope it compiles at this point and start fixing it !!

      CI/CD = Continuous Impediment/Continuous Despair

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #8

      I use WinMerge for single files. Used to be much better before someone got the idea that when a directory on one side was empty that one should (must) show all the files on the other side. So now I also use BeyondCompare. Just need to figure out all of the rules to add every time I must install it fresh. And then I make sure I am very, very focused on figuring out the updates.

      C N 2 Replies Last reply
      0
      • J jschell

        I use WinMerge for single files. Used to be much better before someone got the idea that when a directory on one side was empty that one should (must) show all the files on the other side. So now I also use BeyondCompare. Just need to figure out all of the rules to add every time I must install it fresh. And then I make sure I am very, very focused on figuring out the updates.

        C Offline
        C Offline
        charlieg
        wrote on last edited by
        #9

        BC is legendary in my book. It even will show you what changed in images. now, if they could lock down comparing Excel files, I would die and go to heaven.

        Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

        S 1 Reply Last reply
        0
        • C charlieg

          If you are comparing code - I strongly STRONGLY recommend Beyond Compare. My coworker, mentor, boss sent me in this direction, and I never looked back. As far as the general process - full disclaimer I use SVN and Tortoise, so I cannot speak to what GIT does - doing a large merge should be off in a branch. Once you are done and happy, you can migrate it to the trunk. Using this approach, you have a retreat path. Feel free to do as many commits as you want on the branch to show your merge work. Better yet, have developer 1 and 2 commit their work on separate branches and merge those. Protect the trunk.

          Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

          J Offline
          J Offline
          Jeremy Falcon
          wrote on last edited by
          #10

          Funny, I mentioned BC and no upvotes for me. Starting to think the people of this place aren't mature and rational. :laugh: :laugh: :laugh: Oh and thumbs up for mentioning BC.

          Jeremy Falcon

          D 1 Reply Last reply
          0
          • C charlieg

            BC is legendary in my book. It even will show you what changed in images. now, if they could lock down comparing Excel files, I would die and go to heaven.

            Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

            S Offline
            S Offline
            StarNamer work
            wrote on last edited by
            #11

            charlieg wrote:

            now, if they could lock down comparing Excel files, I would die and go to heaven.

            Since Excel files are containers for multiple files, this would be like comparing two folders with added complications. In addition to there being multiple worksheets containing either grids or charts (and also charts on the grids), there's also highlighting, conditional rules, VBA macros, etc.. And that's before you consider how to actually display the difference between 2 versions of a worksheet, assuming they can be matched up when columns and rows may have been moved around, the worksheets have been renamed and moved into a different order... Checking if the value of one cell has changed or is now a formula or an inserted image is barely the beginning!

            C J 2 Replies Last reply
            0
            • J Jeremy Falcon

              Funny, I mentioned BC and no upvotes for me. Starting to think the people of this place aren't mature and rational. :laugh: :laugh: :laugh: Oh and thumbs up for mentioning BC.

              Jeremy Falcon

              D Offline
              D Offline
              Daniel Pfeffer
              wrote on last edited by
              #12

              Jeremy Falcon wrote:

              the people of this place aren't mature and rational.

              Developers mature and rational? You must be from the alternate timeline! :D

              Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

              J N 2 Replies Last reply
              0
              • D Daniel Pfeffer

                Jeremy Falcon wrote:

                the people of this place aren't mature and rational.

                Developers mature and rational? You must be from the alternate timeline! :D

                Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                J Offline
                J Offline
                Jeremy Falcon
                wrote on last edited by
                #13

                :laugh: :laugh: :laugh:

                Jeremy Falcon

                1 Reply Last reply
                0
                • D Daniel Pfeffer

                  Jeremy Falcon wrote:

                  the people of this place aren't mature and rational.

                  Developers mature and rational? You must be from the alternate timeline! :D

                  Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                  N Offline
                  N Offline
                  Nelek
                  wrote on last edited by
                  #14

                  Daniel Pfeffer wrote:

                  Developers mature and rational? You must be from the alternate timeline dimension!

                  FTFY

                  M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                  1 Reply Last reply
                  0
                  • J jschell

                    I use WinMerge for single files. Used to be much better before someone got the idea that when a directory on one side was empty that one should (must) show all the files on the other side. So now I also use BeyondCompare. Just need to figure out all of the rules to add every time I must install it fresh. And then I make sure I am very, very focused on figuring out the updates.

                    N Offline
                    N Offline
                    Nelek
                    wrote on last edited by
                    #15

                    Was there not an export or save command for the rules?

                    M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                    1 Reply Last reply
                    0
                    • M Maximilien

                      Or just hope for the best or just re-write everything from scratch with the 2 versions on different screens for reference ? I added a new feature in my developement branch as part of some bigger changes (database) , I needed to backport it to main branch, and I improved it on the main branch. Now I have to merge it back to the development branch. lolz... :rolleyes: I just hope it compiles at this point and start fixing it !!

                      CI/CD = Continuous Impediment/Continuous Despair

                      J Offline
                      J Offline
                      Jef fJacobson
                      wrote on last edited by
                      #16

                      I use `git rebase master` to put the branch's changes on top of the current version of master. You'll have to resolve conflicts just like with `git merge`. After you're finished, then use `git push --force-with-lease` to push your changes to your remote branch. (You might need to ask the repo administrator to grant you this permission, or push these changes to a new remote branch if that is not possible. The reason the permission might be denied is that force pushes rewrite history, so if two people are working on the same branch it can cause problems.)

                      1 Reply Last reply
                      0
                      • C charlieg

                        If you are comparing code - I strongly STRONGLY recommend Beyond Compare. My coworker, mentor, boss sent me in this direction, and I never looked back. As far as the general process - full disclaimer I use SVN and Tortoise, so I cannot speak to what GIT does - doing a large merge should be off in a branch. Once you are done and happy, you can migrate it to the trunk. Using this approach, you have a retreat path. Feel free to do as many commits as you want on the branch to show your merge work. Better yet, have developer 1 and 2 commit their work on separate branches and merge those. Protect the trunk.

                        Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                        S Offline
                        S Offline
                        ShawnVN
                        wrote on last edited by
                        #17

                        Can latest BC do a three-way diff/merge? (ie. diff 2 branches against a common ancestor) I think that's why I've stuck with Araxis Merge .. but may give latest BC a try again. Araxis costs $

                        C 1 Reply Last reply
                        0
                        • S ShawnVN

                          Can latest BC do a three-way diff/merge? (ie. diff 2 branches against a common ancestor) I think that's why I've stuck with Araxis Merge .. but may give latest BC a try again. Araxis costs $

                          C Offline
                          C Offline
                          charlieg
                          wrote on last edited by
                          #18

                          I believe so... I try to avoid that.

                          Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                          1 Reply Last reply
                          0
                          • S StarNamer work

                            charlieg wrote:

                            now, if they could lock down comparing Excel files, I would die and go to heaven.

                            Since Excel files are containers for multiple files, this would be like comparing two folders with added complications. In addition to there being multiple worksheets containing either grids or charts (and also charts on the grids), there's also highlighting, conditional rules, VBA macros, etc.. And that's before you consider how to actually display the difference between 2 versions of a worksheet, assuming they can be matched up when columns and rows may have been moved around, the worksheets have been renamed and moved into a different order... Checking if the value of one cell has changed or is now a formula or an inserted image is barely the beginning!

                            C Offline
                            C Offline
                            charlieg
                            wrote on last edited by
                            #19

                            lol, I didn't say it would be easy. I get the difficulty. I could live with just textual changes.

                            Charlie Gilley “They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759 Has never been more appropriate.

                            1 Reply Last reply
                            0
                            • M Maximilien

                              Or just hope for the best or just re-write everything from scratch with the 2 versions on different screens for reference ? I added a new feature in my developement branch as part of some bigger changes (database) , I needed to backport it to main branch, and I improved it on the main branch. Now I have to merge it back to the development branch. lolz... :rolleyes: I just hope it compiles at this point and start fixing it !!

                              CI/CD = Continuous Impediment/Continuous Despair

                              S Offline
                              S Offline
                              ShawnVN
                              wrote on last edited by
                              #20

                              One advanced technique -- maybe overkill for your scenario but sometimes necessary.. I had to do this recently -- use a tool like Araxis Merge to do a three-way diff/merge (compare 2 branches against a common ancestor). 1- use `git merge-base BranchA BranchB` to find common ancestor .. create a new branch BranchC off that commit 2- clone/checkout BranchA and BranchB in separate subdirectories 3- launch a three-way merge: A(left), C(center), B(right) .. manually merge stuff to BranchC 4- commit BranchC .. then merge those changes back up to BranchA and BranchB this will lose some commit-history from incremental changes in BranchA and BranchB.. vs cherry-picking from A to B then merging back to A but if those branches were messy and conflicting, then that commit-history might have been unintelligible anyway

                              1 Reply Last reply
                              0
                              • M Maximilien

                                Or just hope for the best or just re-write everything from scratch with the 2 versions on different screens for reference ? I added a new feature in my developement branch as part of some bigger changes (database) , I needed to backport it to main branch, and I improved it on the main branch. Now I have to merge it back to the development branch. lolz... :rolleyes: I just hope it compiles at this point and start fixing it !!

                                CI/CD = Continuous Impediment/Continuous Despair

                                M Offline
                                M Offline
                                MSBassSinger
                                wrote on last edited by
                                #21

                                The best technique I have found is what I do before I have to merge. I create my working branch from whatever “main” branch is “gold”. Every morning, I merge that main branch into my working branch to pick up any changes others pushed up. At worst, there is an occasional small manual merge affecting a line or two. Then, when I create my pull request to merge my working branch into that main branch, I don’t have merge conflicts. A little preventive medicine goes a long way.

                                1 Reply Last reply
                                0
                                • S StarNamer work

                                  charlieg wrote:

                                  now, if they could lock down comparing Excel files, I would die and go to heaven.

                                  Since Excel files are containers for multiple files, this would be like comparing two folders with added complications. In addition to there being multiple worksheets containing either grids or charts (and also charts on the grids), there's also highlighting, conditional rules, VBA macros, etc.. And that's before you consider how to actually display the difference between 2 versions of a worksheet, assuming they can be matched up when columns and rows may have been moved around, the worksheets have been renamed and moved into a different order... Checking if the value of one cell has changed or is now a formula or an inserted image is barely the beginning!

                                  J Offline
                                  J Offline
                                  jschell
                                  wrote on last edited by
                                  #22

                                  StarNamer@work wrote:

                                  how to actually display the difference between 2 versions of a worksheet

                                  So maybe a real use for 3d headsets?

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups