sirFunkenstine
sirFunkenstine

Reputation: 8505

Ignore git annotations by user, Android Studio

My situation is: We have a huge old unformatted codebase that a lot of people have contributed to.

We want to reformat the entire thing, but the problem is, we will lose our entire git history if we do.

It will look like our whole codebase was updated in 2016 by a single user.

My Question is: Are there any plugins in android studio that let the user modify git revision/annotation history settings to ignore specific revision numbers or commits by a certain user and display the revision history from the previous user that edited that line of code?

I've looked all over and haven't found anything so far.

Upvotes: 0

Views: 415

Answers (3)

DA_123
DA_123

Reputation: 385

The following removes most, but not all of the blamed lines. If a line cannot be attributed to a previous commit, then it is attributed to the refactoring commit

Create a file: .git-blame-ignore-revs

  • one line per ignored commit hash, # for comments
git config --local blame.ignoreRevsFile .git-blame-ignore-revs

https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revltrevgt

Do not define the config globally as it will break git blame for repositories without this file: git blame with optional ignorerevsfile

Upvotes: 0

CodeWizard
CodeWizard

Reputation: 142422

You did not found answer since it cannot be done

Git is designed in a way that each commit is pointing t its previous one and any attempt to re-write history will result in a rebase.

enter image description here


If you wish to delete certain commits made by user you can do it using filter-branch of BFG but again it will result in rebase.

Upvotes: 1

Vampire
Vampire

Reputation: 38724

I don't think this is possible.
But what you can do is, if you annotate and see, the line was last changed by that reformat, right click the annotation stuff in the gutter and select Annotate previous revision and you will see the Annotations from the previous revision on in a new Editor.

Upvotes: 1

Related Questions