title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
Thursday, April 21, 2022 | |
Okay, one sinister trick I've recently learned in git is to commit something "for" someone else. Sometimes, that's literally what I need to do. I had a case recently where a coworker was, for whatever reason, having a hard time committing, but he sent me the code directly. So I looked up if I could check it in for him myself and still have his info pop up if someone git blame-d the file.
Turns out that's pretty easy.
Even better, I don't even need to enter all that author info if the author has commited before:
But which Pat is going to be used?
You can find out with this command:
git rev-list --all -i --author=Pat That will give you a list of commits by that author. The author for the most recent one in the list is the author that'll be used if you use that string (here Pat) in your git commit command.
My favorite use now is when I prettier a file, I can do so without overwriting ownership [if the file was [even mostly] written by a single author]. Usually I'd churn the whole file simply because of whitespace and look like I was own the hook for the whole thing. Now I can give that credit where it, um, belongs.
I think there's a way to log and maybe even blame files in git that ignores whitespace, but until I dig that back up, this is pretty useful.
(Note that it's not all ninja like. There is a "Committed by:" line registered in git that says you did it. But that takes some sluething and is totally fair.) Labels: git, noteToSelf posted by Jalindrine at 4/21/2022 03:05:00 PM |
|
| |
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
![]() |
|
|