Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoiding merge conflicts caused by not gitignoring database #111

Open
raghubetina opened this issue Feb 17, 2020 · 12 comments · May be fixed by #154
Open

Avoiding merge conflicts caused by not gitignoring database #111

raghubetina opened this issue Feb 17, 2020 · 12 comments · May be fixed by #154
Assignees
Labels

Comments

@raghubetina
Copy link
Contributor

I've always worried about the tradeoff between:

  • Conceptual clarity of including the sqlite database in the repo and therefore sidestepping the messiness of having to rollback migrations before switching branches / being able to solve data integrity issues by jumping back to previous commits.
  • Merge conflicts caused by data differences in different branches.

Is this a potential solution?

https://stackoverflow.com/questions/15232000/git-ignore-files-during-merge

If so, we should consider including an appropriate .gitattribute file in all projects.

@raghubetina raghubetina changed the title Handling merge conflict of database Handling merge conflict caused by not gitignoring database Feb 17, 2020
@raghubetina raghubetina changed the title Handling merge conflict caused by not gitignoring database Avoiding merge conflicts caused by not gitignoring database Feb 17, 2020
@raghubetina
Copy link
Contributor Author

@jelaniwoods This should maybe go into web_git repo, but anyway. I think we should prioritize this and add a merge strategy for the development.sqlite3 file.

@jelaniwoods
Copy link
Contributor

jelaniwoods commented Jun 8, 2020

@raghubetina I don't understand when would a merge even occur in the student's git workflow? Since we do save the development.sqlite3 in the git History, checking out other branches shouldn't cause any merge conflicts— right?

@raghubetina
Copy link
Contributor Author

raghubetina commented Jun 9, 2020

@jelaniwoods Yes, I believe checking out other branches shouldn't cause any issues. (Although I feel like I have noticed some "Pending migration" situations when I jump back and forth between branches, which I was hoping to avoid by ungitignoring development.sqlite3; I haven't had time to try and reliably reproduce.)

It's true that we currently landed upon a merge-free workflow, with git push heroku HEAD:master -f in a single-person-only-deploying-"best"-branch situation. However in the past (e.g. on Very Best) and in the future, we'll want students to work in teams and therefore they will need to learn to merge. This quarter for example I would like to try and have them do ICPC-style problem sets during class, merging solutions and rails gradeing.

@jelaniwoods
Copy link
Contributor

@raghubetina okay that makes sense. I assume then a merge section needs to be added to web_git at some point after the core functionality is working at acceptable speeds and without errors.

@jelaniwoods jelaniwoods linked a pull request Jun 9, 2020 that will close this issue
3 tasks
@jelaniwoods
Copy link
Contributor

@raghubetina according to the git documentation and this answer we need to be update the git configuration to use the merge strategy, I can think of a couple ways to do this but wanted to get your opinion:

  • Can run the git command in bin/setup
  • Can run the git command in a separate script that only runs once per workspace
    • Can shell out command or use git gem somehow

These approaches seem mostly equivalent to me. Am overlooking something?

@raghubetina
Copy link
Contributor Author

raghubetina commented Jun 9, 2020

@jelaniwoods In the past we relied on GitHub's built-in merging UI, and I was hoping to continue to do so; I don't relish the idea of building a UI for resolving conflicts, although I suppose it wouldn't be too bad. (We could perhaps build-in a button for "Merge" that greys out when it detects that it's not a fast-forward merge, and suggests to push to GitHub and handle it there in that case.)

I would like students to

  • Push to GitHub
  • merge their branch to master on GitHub (resolving conflicts there)
  • switch to master locally
  • pull from GitHub
  • checkout a new branch to work on their next task
  • rinse and repeat

I thought that defining a .gitattributes file and specifying a strategy for handling development.sqlite3 might work while merging on GitHub, but now that I read that SO thread in more detail, perhaps GitHub won't be able to do it since we can't define the actual strategy on GitHub. Requires experimentation.

@jelaniwoods
Copy link
Contributor

OH, okay. I will investigate with GitHub's merge to see if if will accept the strategy.

@jelaniwoods
Copy link
Contributor

@raghubetina after a little research and testing, it doesn't appear that GItHub respects .gitattributes file.

This SO answer further suggests that GitHub doesn't look at the file https://stackoverflow.com/a/24382933/10481804
I tested in this PR jelaniwoods-FurtherLearning/wweeeee#8

@raghubetina
Copy link
Contributor Author

@jelaniwoods What happens when you have conflicts in a binary file during GitHub merge? Does it let you pick one or the other, or does it just fail?

@jelaniwoods
Copy link
Contributor

jelaniwoods commented Jun 9, 2020

@raghubetina In the PR I tested with the conflict of development.sqlite3 couldn't be resolved in the web editor.

Screen Shot 2020-06-09 at 3 46 11 PM

@raghubetina
Copy link
Contributor Author

@jelaniwoods Blergh. I wonder how good Gitpod's built-in git UI is for merging.

@jelaniwoods
Copy link
Contributor

@raghubetina If it's local merging we can use .gitattributes and pick a version so we don't need to resolve conflicts.

Trying to merge without .gitattributes looks tricky. There doesn't appear to be any UI change and even the diff on the command line is unhelpful.

Screen Shot 2020-06-09 at 4 27 42 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants