0

I tried some of the tips listed in this thread: Find out git branch creator

For example:

git for-each-ref --format='%(authorname) %09 %(refname) %09 %(committerdate)'

But encounter general problems:

  1. Sometimes I get listed as author of somebody else's branch that I have never checked-out or touched. Not sure exactly when, but in one case, there was an automatic merge from another user's push, and following my push right after that, I get listed as author of both mine and his branch.

  2. The list will include some branches that have actually been deleted from remote.

Anyone has some clue why this happens, and how to resolve?

Community
  • 1
  • 1
Rop
  • 3,359
  • 3
  • 38
  • 59
  • As mentioned in the thread you linked to, Git does not track branch creators. You're looking at branch *tips*, i.e. the author of the *most recent* commit on each branch. – ChrisGPT was on strike Sep 03 '14 at 15:10
  • Sure, I got it that git doesnt track "creator". But still find it pretty weird how you can be labelled as "author" of a branch you have never even checked-out or touched in anyway. Common sense, I would say it is clearly a "bug" somewhere... but since I am not a professor in "gittology", what do i know? :) – Rop Sep 03 '14 at 18:03
  • Actually, you *can't* be labelled as the author of a branch; there's no such thing. This command shows the author of *the most recent commit on each branch*. – ChrisGPT was on strike Sep 03 '14 at 18:35
  • OK... and how can I ever be the "author" of the most recent commit, on a branch I never touched? – Rop Sep 03 '14 at 18:45
  • 1
    That I can't answer without more details. But if somebody else fast-forward merges a commit of yours into a branch, I'm pretty sure that would count. – ChrisGPT was on strike Sep 03 '14 at 18:50

1 Answers1

1

Sometimes I get listed as author of somebody else's branch that I have never checked-out or touched. Not sure exactly when, but in one case, there was an automatic merge from another user's push, and following my push right after that, I get listed as author of both mine and his branch.

It is hard to tell what you might have done, but if that command is telling you are the author of a given branch it means the last commit was authored by you.

The list will include some branches that have actually been deleted from remote.

You can use git remote prune for that :

prune

Deletes all stale remote-tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/".

Emil Davtyan
  • 13,808
  • 5
  • 44
  • 66