0

We have a dev team of 10 and our 7,000 commit history needs a little bit of maintenance. People have committed with the wrong credentials (making our author list rather gross), and I'd also like to obliterate a grunt dist/ directory that we don't need to track in git any longer (truth be told, we never should have been tracking dist/, but that's another subject...)

My question is, what is the best way to push the history changes to origin without causing any issues for the team? After my rewrites (locally), I'm showing 3 times as many commits as we had originally. I will make sure the timing of this push is such that everyone needs to branch from master, but I'm not sure what sort of negative affects could come from this action.

Is there a way that I can clean up the history after making these changes, or what's the best way to go about this?

Wade Williams
  • 3,943
  • 1
  • 26
  • 35
  • Rather than modifying the history of your repo, maybe you should start a *new* repo at a different location, and tell everyone to clone that separately? – Chris Martin Dec 09 '13 at 00:59
  • I've thought about this but I'd prefer to keep git blame functioning properly. – Wade Williams Dec 09 '13 at 01:01
  • I'm not suggesting that you kill the version history, just that your revised repo be hosted at a different remote URL to avoid "confusing the team". – Chris Martin Dec 09 '13 at 01:04
  • Oh - we're all colocated so i'm less concerned with the actual changeover for the team as much as any unintended side affects - as long as the rewritten history is in play, I'm not sure how much migrating to a new physical repo would help. – Wade Williams Dec 09 '13 at 01:09
  • Maybe I don't understand your question, or what sorts of "side effects" you're envisioning. My point is that as long as everyone starts over with a fresh clone of the revised repository and is okay with abandoning their local branches, I see no way there could be any issues. – Chris Martin Dec 09 '13 at 01:57

1 Answers1

2

You should not rewrite history as it is very intrusive - everybody will have to re-clone repository from scratch.

Instead, consider creating appropriate .mailmap file as described in git shortlog documentation. .mailmap allows to display weird-looking authors in consistent way, thus solving your problem without touching history.

If you really have to rewrite, you can use this recipe, but it only works for linear history (one branch without any merges).

Community
  • 1
  • 1
mvp
  • 111,019
  • 13
  • 122
  • 148
  • Very good - thanks, I haven't read enough about the .mailmap function but I will look into that. However, as far as obliterating the dist/ directory, there's a large number of commits that are tied to that resource that we no longer need, I'd like to get rid of them if possible. – Wade Williams Dec 09 '13 at 01:03