How long does git keep out

Assume I create a branch in my local repository named feature1 based on master and add one or two commits. Then I switch back to master and decide that feature1 is not going to make it and delete the branch.

I assume that a branch is basically a "pointer" to a particular commit object.

Now on to the actual questions.

  • Is the assumption above correct, perhaps in some simplified sense?
  • For how long do the commit objects still exist on the filesystem (so that I can later do git checkout SHA1-HERE )? Is there some kind of "retention policy" that would remove commits which are not part of any existing branch history or tag (not sure if using correct terminology here...) ?
  • Would any of the above be dependent on the git server's implementation (gitosis, github, etc...)?
  • If the objects are kept around forever and are not auto-cleaned after some time/event, would it imply that setting git's receive.denyNonFastForwards as a measure to prevent data loss is meaningless?
  • Reason for this question: I am currently working on a project that has receive.denyNonFastForwards enforced on the basis that it avoids losing any committed work (I suspect receive.denyDeletes is also enforced). I want to make sure there is no better way to preserve commited but unmerged work and also be able to clean up old branches to avoid clutter.


    The default s 90 days:

    gc.reflogexpire
    gc.<pattern>.reflogexpire
    

    git reflog expire removes reflog entries older than this time; defaults to 90 days. With " <pattern> " (eg " refs/stash ") in the middle the setting applies only to the refs that match the <pattern> .

    So:

  • Yes
  • 90 days
  • no (you actually can contact GitHub support to ask them and restore a deleted pushed branch)
  • "preserve commited but unmerged": you can push it on a dedicated dev branch or to a dedicated upstream repo (just for you)
  • 链接地址: http://www.djcxy.com/p/82944.html

    上一篇: Maven:什么是“mvn

    下一篇: git保持多久