Git-blame-someone-else
github.com
github.com
Guess that's middle management then.
Git Blame-Someone-Else - https://news.ycombinator.com/item?id=21004193 - Sept 2019 (66 comments)
Git-blame-someone-else – Blame someone else for your bad code - https://news.ycombinator.com/item?id=11049993 - Feb 2016 (65 comments)
https://github.com/jayphelps/git-blame-someone-else/graphs/c...
I assumed they were recording actions taken via the github UI and APIs, not the git commit log. If someone merges a pull request you opened, poof, you contributed the lines merged from that pull request regardless of the git author line. Same if you run `git push` with your github login credentials.
Apart from attributing things to the wrong person, git author line seems like it must also have the issue of not attributing things at all. What if I signed up with a different email address than I use for git?
To be honest, when you really think about it, any commit that is not GPG signed is unverifiable. It could be anybody. I wish signing commits was more widespread.
[1] https://docs.github.com/en/github/authenticating-to-github/m...
My workmates would hate me if i introduced this to production.
You gain the ability to prove that a certain commit came from your machine or someone with full access to it, they don't.
To be honest, everyone should be signing their commits in a professional environment. It takes minutes of work to set up and greatly increases the trust you can have in the code base.
If you're scared of affecting your workflow, just don't protect the GPG keys with a password (dangerous) or use your operating system's trust store to unlock them at login (less dangerous, but still suboptimal).
I sign my work commits without ever entering a password in a prompt. Some of my coworkers also sign their commits, most of them don't.
https://git-scm.com/docs/git-blame#Documentation/git-blame.t...
Once you move on from just banal issues like whitespace and move your way up to actual structural concepts in the code, ad-hoc starts completely falling apart (at least in my experience.)
I once encountered someone who did a giant re-formatting of code by rewriting past commits. Pretty disruptive for a day but did manage to keep history in-tact. Also, a little (or a lot?) dangerous...
It's usually called "blame previous revision".
git commit --amend --author=[...](Still among the best-commented code I’ve ever written.)
I've never needed to use 'git blame' and I see no reason to, unless you really are just trying to look for a person to blame.
Also if the code is from a time frame before we agreed to stop writing code a certain way, that’s one thing. If it’s new, the person needs some feedback.
Another example: I use the nightly Rust compiler as a library, which have unstable API. git-blame helped track down which commits change the APIs I use when I'm updating the compiler version my project depends on. git-bisect is the other useful part of git for this purpose.
git config --global alias.praise blame
Git doesn't store what actually was changed. Git stores how to reconstruct the new file from the old file in a space efficient way.
This is unrelated to storage of who changed what, only "what is the minimal way to reproduce the end state from the beginning state".
As a result, tools like blame take the two versions and try to figure out what someone actually changed, trying to turn applesauce back into apples.
Whether it gets it right or not has an element of luck to it (the diff algorithms are also often based on finding the minimal sequence of edits.). Whether it happens depends on the algorithm and it's heuristics, and often whether there is a single unique minimal sequences that could produce your end state from your beginning state (if not, it's not actually possible to say what you changed with 100% accuracy)
git log -S instead is saying "give me all the times this line seems to have changed", and then you do the work of figuring out which were real and which are artifacts of the diff algorithm.
This workflow is not subject to any limitations around code structure, variable naming, file moving or anything else. fugitive.vim is a plugin which lets you very quickly recurse into history in this fashion using multiple vim windows.
Yeah, I work in information security for a living, how did you guess?
Even if they they did, once they change the history change, other developers working with the repo would be alerted of the remote branch changing out from under them next time they try to pull. And even if the change doesn't result in a conflict, and each of those other devs blindly accept the resulting merge, the original authors' commits will still be in the history resulting from the merge. So if those developers ever pushed anything, the original commits would be re-introduced.
Now, it could be abused if a single developer inherits a project that nobody else has checked out. But it's still a high risk strategy for the unscrupulous dev.
Have you ever seen that old video "The website is down"? [1]. In it, the guy covers his own tracks with admin privileges. I'm not saying it's easy, just that it's possible.