Hi Everyone, *Use case*: We need to merge the mai...
# help
p
Hi Everyone, Use case: We need to merge the main branch to another branch which has some uncommitted changes. As of now when we try we get the error "uncommitted changes (dirty branch)". Even though we are not working on the same file we get this error and the merge fails. Do we have any possibilities to merge this successfully if the files merged and the files in the uncommitted changes are different? Thank you in advance!!
j
Hey Prabhat! Thanks for this question 🙂 We currently don't support this kind of operation. Do you mind elaborating on the need for it? Is this behavior required by some process?
e
@Prabhat Singh Thanks for sharing your use case with the community. I may have an idea for a workaround. To make sure the workaround I have in mind is useful, can you please share why you can't simply commit your changes to the test branch prior to merging main into the branch?
p
Thank you @einat.orr for putting the solution. We will try the below solution suggested by you and will get back to you if we have any questions/concerns. Following our discussion, the solution suggested is: Each user has 2 branches: A dev and main-replica branch. For example, User1-Main & User1-Dev. The User will work on the dedicated Dev branch. When User1 wants to "push" things into production, they will Commit AND Merge from User1-Dev to User1-Main. 1. A merge hook (or alternatively, a commit hook that runs only when parent = main) will. Creating the following sequence: 2. Automatically merge from User1-Main to Prod (global Main) 3. Commit changes to all other users local Dev branches ("un"dirty) 4. Merge from Prod to All Users Dev branches
🙌 4
p
Glad we have a promising proposal! Out of curiosity, what is the benefit of the main & dev user branches if we’re willing to auto-commit on users’ dev branches? It seems like we can go back to using a single dev branch per user if auto-committing to un-dirty them is ok
e
They use a hook that merges every commit from a user branch to main and then back to the branches of all other users. At this point the merge fails because user branches are dirty.