How can I keep track of where commits came from once they've been merged?

前端 未结 2 2117
迷失自我
迷失自我 2021-02-20 18:44

My company does not maintain the repository with git (we effectively use CVS), but I keep a repo locally for my own sanity. In the past, I\'ve wanted to bring up c

2条回答
  •  后悔当初
    2021-02-20 19:03

    Git doesn't track this information by design.

    http://markmail.org/message/yfb5ihwddjmrstz6

    So don't think of it as "git throws away branch identity" as much as
    "git never cared about branch identity in the first place, and doesn't
    think it's relevant."
    

    Your branch name is just that, your branch name. It can be literally anything you want. Or you can not use a branch name, and be in detached head state. Long term, only commit reachability is stored.

    If you have information you want to track (like a Defect Number), then you need to include it in the commit message.

    If you are using a central server you can setup a receive hook which logs the remote branch name information somehow (git notes for instance). My company uses this. I find it only quasi-useful (mainly if you want to yell at a program manager instead of the guy who wrote or pushed the code).

提交回复
热议问题