#Managing changes across git branches

1 messages · Page 1 of 1 (latest)

digital rampart
#

I'm not great a git management, so I'm unclear of best practices in this scenario.

  1. branch main has dependency [email protected]
  2. you create branch shiny which requires [email protected]
  3. you change some code in main, that should also be changed in shiny

I don't want to push the [email protected] from main to shiny. Do you just manually make the code change in shiny or is there a way to cleanly merge main into shiny? Or maybe the answer is create a feat branch off main, make your code changes, and then merge the feat branch into main and shiny.

Maybe I just answered my own question, while typing that out 😆 but just in case I'll go ahead and post.

This isn't some production app or anything. It's an example repo, so that's why I've been making changes directly to main.

#

Managing changes across git branches

midnight egret
#

You should be perfectly fine merging main into shiny. This is where merge conflicts come in, if changes in main conflict with shiny and its usage of @foo you would resolve them in the conflict. Git will not overwrite your work on the shiny branch if it finds both areas of code were modified. The one thing you would need to be careful of is any new files or changes made to other parts of the code in the main branch that would not conflict with shiny andn its suppert for [email protected]. Git would let those changes mege fine into your branch.