state-machines / state_machines-audit_trail

Log transitions on a state_machines gem to support auditing and business process analytics.
https://github.com/state-machines/state_machines-audit_trail
MIT License
75 stars 24 forks source link

Git history truncated #9

Closed smudge closed 8 years ago

smudge commented 8 years ago

Forgive me for being out of the loop and not noticing until now, but I just saw that the commit history was squashed/truncated when @rosskevin migrated everything from the old repo. I don't really see why that would've been necessary, since most of the changes were pretty straightforward and could have been their own commits.

I know that it's been over a year now, so I'm opening this issue more as a way of striking up a conversation -- was there a reason to start with the clean slate? It had the unfortunate side effect of invalidating all of the original code authorship information, which I'm personally not a fan of (especially when it comes to open source contributions), but I recognize that sometimes projects choose to make that trade-off.

I think the prior commit history would be recoverable with a few git commands and a single force push to master (one of the few cases where force pushing is kinda okay), and the current master branch could still be preserved for posterity in a separate branch (so that those commit hashes don't get lost). But unless there is a strong consensus towards incorporating the old repo's history, then I'm fine resolving the issue and reserving the necessary git-fu for another day.

rosskevin commented 8 years ago

There was no malintent, only the fact that I had never taken over a repo. I don't recall the steps I took to get it here. As you can tell from the readme, I tried to attribute code ownership, but as you mention, I lost all the other contributors in the process.

I would love to reincorporate the history, but I'll ask for someone to do the work to make that happen. A PR would be great if possible. If no one is willing to do the work we should close this.

smudge commented 8 years ago

No worries -- my intention wasn't to place any blame. If I have a chance this weekend I can investigate the feasibility of producing a PR. But if I can't get it working or don't have the time, I'll loop back and close the issue.

smudge commented 8 years ago

So, as a proof of concept, here's a branch that reincorporates the repos by applying the new repo's commits on top of the old:

https://github.com/smudge/state_machines-audit_trail/commits/combine-repos

This was pretty quick to generate, but I'm realizing that actually applying it to your main branch would be a lot trickier than a PR. You'd have to force push my fork's combine-repos branch to this repo's master, because the commits are entirely different and GitHub wouldn't even accept it as a PR.

It would also kind of invalidate any existing checkouts of the code. It would probably be easiest for everyone to re-clone the repo.

So, there ya have it. 😁

Would totally understand if you'd rather keep the current branch structure.

rosskevin commented 8 years ago

@smudge I don't mind a force push if you want to literally spell it out for me. Meantime, I'll keep a local backup of code just in case - catastrophe - I can then just overwrite with the latest.

Is this what you are thinking?

git clone https://github.com/smudge/state_machines-audit_trail -b combine-repos
git push https://github.com/state-machines/state_machines-audit_trail -b master --force
seuros commented 8 years ago
git remote add smudge https://github.com/smudge/state_machines-audit_trail
git push smudge/combine-repos origin/master -f

but please compare both branches before pushing.

smudge commented 8 years ago

You should also do this first, so that the existing commit hashes are preserved somewhere on github (make sure your local master is up-to-date with origin/master):

git push origin master:master-old

Then, to compare the branches, just check that git diff origin/master..smudge/combine-repos comes up empty. I checked last night but best to check yourself locally before running that force push.

smudge commented 8 years ago

Also, looks like the rails-5 branch will be invalidated. You'll need to cherry-pick those 5 commits on top of the new master to recreate the branch.

rosskevin commented 8 years ago

I will fix the rails-5.

I have smudge-compare-master ready on https://github.com/rosskevin/state_machines-audit_trail.

I tried a couple of things, but backed out. (I setup both remotes checked out my branch and git push origin master --force but that wasn't correct)

Please confirm the command to push my branch to the origin/master.

rosskevin commented 8 years ago

I pushed my branch to this repo.

My plan now is to:

  1. delete master
  2. rename smudge-compare-master to master

Any problems with that?

smudge commented 8 years ago

Force pushing would also accomplish the same thing: git push origin combine-repos:master -f

rosskevin commented 8 years ago

Scratch that, I don't see the history on my branch...

rosskevin commented 8 years ago

Ok, I've got the process now, time to do this over again. :)

smudge commented 8 years ago

Ah, yeah, you want that combine-repos branch with many more commits to be the one you force push to master.

rosskevin commented 8 years ago

Awesome, thanks @smudge. I learned a bit more along the way!