University of Oregon

Working on a file in two git branches at one time

I have a file in two different branches of a project that is so drastically different (hundreds upon hundreds of changes) that merging was becoming unreasonable. I’ll call that file CONVOLUTED.module.
I wanted to go old-school and compare the files side by side. Cutting and pasting changes with regular commits so I could test the incremental changes as I manually merged the files.
I figured there are several options to do this.

git branch – auto setup rebase = always

I was revisiting Randy Fay’s Rebase Workflow post and went down the ‘rebase’ rabbit hole again. Each time I learn a little more. Probably because I understand a little more…

This time I landed here: ‘Simpler Rebasing …’ and as a result I’ve updated my git config to rebase on pull:
git config –global branch.autosetuprebase always

Note: this use of rebase isn’t the history altering version, rather an adjustment to the order of operations when pulling from a remote repo. The goal being to lay your local changes on top of the remote code each time you pull.

Here’s how it looks in my git config now:

  autosetuprebase = always #Ref: #alternatively use: git config --global branch.autosetuprebase always

We’ll see how it goes. I’ll add this to my public git_bash_files repository if I like it.