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 Offline
    M Offline
    Maximilien
    wrote on last edited by
    #1

    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

    R 0 P J C 9 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

      R Offline
      R Offline
      Roger Wright
      wrote on last edited by
      #2

      I usually type the lines of code on Hollerith cards, then shuffle the deck like a tarot reader and hope for the best. :-D

      Will Rogers never met me.

      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

        0 Offline
        0 Offline
        0x01AA
        wrote on last edited by
        #3

        Manually or auto: I can feel with you, I have always a bad feeling while merging branches :((

        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

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          Step 1. Take chicken. Step 2. Sacrifice chicken. Step 3. Attempt merge. Step 4. Cook chicken. At least that might work because step 3 sure as hell won't have and, at least you'll have a good meal.

          Advanced TypeScript Programming Projects

          D 1 Reply Last reply
          0
          • P Pete OHanlon

            Step 1. Take chicken. Step 2. Sacrifice chicken. Step 3. Attempt merge. Step 4. Cook chicken. At least that might work because step 3 sure as hell won't have and, at least you'll have a good meal.

            Advanced TypeScript Programming Projects

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

            Pete O'Hanlon wrote:

            Step 2. Sacrifice chicken to Bubastis.

            FTFY :)

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

            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
              Jeremy Falcon
              wrote on last edited by
              #6

              An ounce of prevention is worth a pound of cure. You'll get less merge conflicts (it won't be perfect, just less) with strict formatting rules for the project. But, if it's already out of whack and the mergyness needs to happen... (Speaking git lingo but it should be transferable) Assuming it's a large merge.... 1. If it's not hundreds of commits and the devs actually made smaller commits, use rebase. It'll take a bit to go through all the commits but you can take it in bite sized chunks which may be mentally easier. 2. If it's hundreds of commits then, first make sure you diff tool can ignore whitespace. Something like Beyond Compare will do that. Second, run all your linters and code formatters on both the target and the destination branches before attempting the merge. And lastly, for the love of all things pure do a [3-way merge](https://www.scootersoftware.com/v4help/3-way\_merge\_concepts.html) to help give you context.

              Jeremy Falcon

              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

                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
                                          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