Mark file as someone else's contribution

Hello,

I have some files in a repository (small images stored through LFS) that I want to delete and replace with something more tightly compressed to go easier on the bandwidth. It’s far from a problem *right now* (usage is way below 10% per month) but I’d rather not let it -become- a problem later on.

Now, the issue is some of these files are not originally made by me and I’d rather keep them as the original author’s contribution rather than my own.

So, how do we go about that?

I can of course just reach out to the original author and ask them to upload the modified version but that would take longer. Is there a way to simply mark a file as ‘made by X’?

Thanks.

A commit is assigned to an author based on the commit metadata, therefore you could create a commit for another user by changing the metadata. However, it’s generally bad practice to create commits on behalf of someone else. Fortunately, GitHub supports the concept of “co-authors” which are displayed alongside the actual commit author – therefore, you can commit the changes yourself and identify that the content came from another user.

If you’re using the GitHub website to create commits then you can add the co-author trailer to your commit extended description, e.g:

Co-authored-by: Alice <alice@example.com>

A full outline of how to achieve this (on GitHub Desktop, via the command line and via github.com) is available in the documentation, Creating a commit with multiple authors:

You can attribute a commit to more than one author by adding one or more Co-authored-by trailers to the commit’s message. Co-authored commits are visible on GitHub.