0

My professor at the university wants each of my classmates to add their name to a file with an attendance list.

And my question is what is the most efficient way to do this? Create 22 branches and delegate one person to megre those branches or determine the order between students of writing to the file? Or maybe you know better way to do this.

2 Answers 2

1

Assuming it's a text file, the easiest way to ensure fewest conflicts possible is for every student to know their rank in alphabetical (or some other) order; the first student to create a file with 22 empty lines; and for each student to place their name in the appropriate line. (EDIT: thinking about it, it would be safer to make it 43 empty lines, so you can have a blank line between every pair of names; then for the last person to delete the empty lines.)

Second technically easiest is to use this order to set a schedule, though it'd be a nightmare to pull off with 22 students. Herding cats is easy in theory, horrible in practice.

The third easiest way (and way easier in practice) is for everyone to just edit the file, add themselves, commit and push as fast as possible, at a random time - especially the first couple of people, to provide context for diff to work with.

Sign up to request clarification or add additional context in comments.

1 Comment

I'm not sure one empty line is enough :-)
0

It seems to me you're over-thinking this. What would happen if you did nothing at all to coordinate? That is, suppose you just have everyone clone the repo, edit the file, and push their result without worrying about what anyone else is doing...

Someone will "just happen" to push first. That push will go through. The next person will get an error saying they're not up to date. So they'll pull, resolve the simple conflict (if there is a conflict, which there may or may not be), push, and be done.

The worst case is that multiple people are resolving conflicts at the same time, and so all but one of those will have to re-resolve; which, granted, could get annoying if everyone's trying to complete this at the same time. But assuming you have a reasonable time window in which this is going to take place, it's likely that won't be a big problem. And in fact this is more or less the point with git - a large number of people can work on the same file(s) concurrently without contrived coordination.

Now, some people would argue that the resulting history is, in their view, "messy" because any time someone had to pull then push, a merge commit is created. Worst case, that's still not worse than what it would look like if everyone added their name on a separate branch. And, it's possible to avoid even that (e.g. by using 'get pull --rebase' when prompted to pull before pushing).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.