1

Lets say on a given branch the following are the commits of 2 users(U1 and U2)

U1: C5 -> HEAD
U2: C4
U2: C3
U1: C2
U1: C1
Base commit: C0

Is there a way you can squash the commits from C1 to C5 into a single commit while retaining the ownership(in git blame) of each of the authors?

OR

Is there any other approach in git where you can squash commits (from multiple users) into a single commit and still be able to find out who made what changes?

user376507
  • 2,004
  • 1
  • 19
  • 31
  • 1
    No. It seems like you’re pretty much asking for all the effects of separate commits without having separate commits, but that’s just what they’re for. If you want this for convenience of browsing history and always squash commits of a branch to apply them to a master branch, maybe you can use merge commits instead and only browse those? – Ry- Feb 25 '19 at 03:57
  • https://stackoverflow.com/a/52775951/6309 can help – VonC Feb 25 '19 at 05:45

1 Answers1

1

Not really. The author of the lines will be whoever authors the revision... if you are squashing, who gets to keep it? I guess people normally set the top revision to be picked and the others to squash so the top revision owner will be it (or whoever gets the revision with the pick, say). If you want to keep the real authors, then I think you should not squash at all (actually I wonder why people would squash stuff from other developers but anyway.... not my problem, the tool allows for people to do it so....).

eftshift0
  • 26,375
  • 3
  • 36
  • 60