Live data from Hacker News

How to take credit for someone else's work on GitHub

repography.com

171–180 of 185 posts

Re: How to take credit for someone else's work on GitHub

#171
post #129

Earlier quoted context omitted.

I had this happen on a small PR I submitted within the past year. I didn’t think anything of it at the time, but your comment led me to glancing through the past PRs and it’s comical how many are closed with a “thanks, I’ve committed an equivalent patch” comment. One the one hand, it’s his repo and he’s free to do whatever he wants. I actually admire how ruthless the maintainer is on closing issues, must be great for…

The alternative is way worse: it turns into this culture of forcing people who just tried to help with something minor to suddenly be bullied asking for updates to code they were done with. I gave you a fix. It was a potential fix. It was one of many possible fixes. It is your project, and you should figure out what you actually want to commit. And yet way too often the maintainer spends more time trying to explain t…

> And would I have minded if they didn't put me there? No, and honestly I almost find it weird sometimes that they did... I certainly didn't ask.

Having your name in the credits brings some of your reputation to their project. Having 'name brand' contributors is a benefit all its own for many projects.

Re: How to take credit for someone else's work on GitHub

#172

Earlier quoted context omitted.

If everyone is concerned about commit identity hijacking, you can configure your repo settings to reject any commits which aren't GPG signed. https://docs.github.com/en/authentication/managing-commit-si... https://www.devopsauthority.tech/2020/07/18/github-getting-s...

that's great but it requires an active step on behalf of the user which is violating secure defaults principle. it also violates the principle of good UE

There's no way around it, because git commits by default can be forged due to the way it was designed.

Re: How to take credit for someone else's work on GitHub

#173
post #137

Earlier quoted context omitted.

Viewing a specific commit or viewing the repositories' statistics ("insights" tab) both have no attached branch.

in Github or in Git itself? While possible, I don't believe there's many floating commits around. The other issue of course is that at this point in time, there would not be a .mailmap. Of course, github can then fall back to a .mailmap file in the latest commit of the main branch.

Commits are not usually floating but are very commonly in more than one branch.

Re: How to take credit for someone else's work on GitHub

#174
post #159

Earlier quoted context omitted.

That wouldn't work, for example, when you're pushing commits someone else did in another repository. Git is decentralized, so you end up pushing a lot of code that you didn't commit if you use it the way it was intended. The solution, in my opinion, is to show a great big warning or error icon next to the name of every unverified commit, and to every unverified push as well. Developers and version control managers ca…

> That wouldn't work, for example, when you're pushing commits someone else did in another repository. What? Why??

Because git is designed to be decentralised. You can push and pull changes to your coworkers' laptops, merge everything, and then push it to a centralised place like Github. Great for when you work at an office with limited internet connectivity or develop your code across multiple mirrors (gitlab + github, for example).

Consider the way the Linux kernel is developed. Change sets are committed and emailed back and forth, and eventually merged. The merged git repository is the official, released source code, but before that change sets are just (attachments to) emails. Then, at some point, someone pushes the changes to Github, containing thousands of merges from tons of people.

Git was designed to work this way, and cryptographic signatures solve the problems that can arise from allowing random change sets. You can sign the commits themselves, as well as the pushes (although signed pushes aren't as universally supported by version control software).

Re: How to take credit for someone else's work on GitHub

#175
post #55

Earlier quoted context omitted.

In many cases this is the right thing for a maintainer to do: a contributor produces a PR and a proposed patch, but often that patch doesn't solve the whole problem, or clashes with the coding style, or isn't very efficient, so the maintainer does their own fix, because that is faster than getting the contributor to produce a modified version.

On GitHub you can push commits to the PR branch. I use that to fix up rough edges myself and then merge the PR.

Oh wow never realised that was possible! Thank you!

That will save so much time and energy having to deal with back-and-forths or abandoned PRs

Re: How to take credit for someone else's work on GitHub

#176
post #55

Earlier quoted context omitted.

In many cases this is the right thing for a maintainer to do: a contributor produces a PR and a proposed patch, but often that patch doesn't solve the whole problem, or clashes with the coding style, or isn't very efficient, so the maintainer does their own fix, because that is faster than getting the contributor to produce a modified version.

Yes, I do this for my own OSS projects. The standard approach of giving feedback and waiting for the user to fix something is fine, but for a small change it's easier to just expedite the process and do it myself. But if my version of the code has substantial changes (ie changes beyond just whitespace, small tweaks to the code, changing the commit message), I push it to a branch and ask the PR author to review and ap…

Thank you for all of these tips!

I've lately been feeling bad, and thinking I must look like an ungrateful asshat, about closing lower quality PRs (IMHO) with valid bugfixes but which introduces some new, possibly subtle, bug instead. Or having to close abandoned PRs because the submitter gave up before that last polishing to match the standard of my own repo. :(

Now I feel better knowing that I can do that final polish myself, while keeping the submitters original contrib!

Re: How to take credit for someone else's work on GitHub

#177

Earlier quoted context omitted.

The polite thing is to fork the contributor's PR branch back into the project repo, make changes preserving history, and then merge or squash merge the result.

It is a bit awkward though. Some projects by nature attract high quality PRs. Others, like a game I built, have the unfortunate curse of attracting PRs with such low quality that it's kinda heart-breaking to shut them down. It's one thing to read a good feature request in a Github issue and build it yourself. It's a whole other thing to modify a low quality PR in a polite way, see what they were trying to do, clean i…

Yap and that's when you start feeling that OSS burnout creeping up on you.

Re: How to take credit for someone else's work on GitHub

#178
post #144
post #64

Earlier quoted context omitted.

Now you're thinking like the author of git-blame-someone-else: https://github.com/jayphelps/git-blame-someone-else

IIRC there was an infamous (at the time) user hostile commit made to a Google product (Android or Chrome perhaps) where the author was obfuscated to something like "Android Dev" instead of an actual individual.

Perhaps this commit?:

https://android.googlesource.com/platform/packages/apps/Glob...

Discussed in https://news.ycombinator.com/item?id=17487441

Re: How to take credit for someone else's work on GitHub

#179
post #159

Earlier quoted context omitted.

> That wouldn't work, for example, when you're pushing commits someone else did in another repository. What? Why??

Because git is designed to be decentralised. You can push and pull changes to your coworkers' laptops, merge everything, and then push it to a centralised place like Github. Great for when you work at an office with limited internet connectivity or develop your code across multiple mirrors (gitlab + github, for example). Consider the way the Linux kernel is developed. Change sets are committed and emailed back and fo…

Yes, so GitHub showing the individual commit's email addresses and not replacing it with the name of an associated GitHub account wouldn't work ... because?

Re: How to take credit for someone else's work on GitHub

#180

Because Git/Github is source control tool not a forensic tool.

This implies that assuring a commit's provenance is beyond the scope of git, which is wrong. Git supports cryptographic signing of commits for this purpose.
Post reply on HN