4

Questions about Git dangling commits on systems like GitHub and BitBucket:

Do these systems garbage collect, so that dangling commits would eventually get removed? (I know they are bad for other repos users, I'm just exploring what-ifs)

Is there a way to fetch/clone the remote repos so these commits are included (ie get a full copy of all commits it contains)? I've tried this but I don't get the detached commits, I guess I'm missing a switch.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
user826840
  • 1,233
  • 2
  • 13
  • 28
  • Do these systems garbage collect? http://stackoverflow.com/questions/4367977/how-to-remove-a-dangling-commit-from-github/32840385 Fetch them on SU: http://superuser.com/questions/333997/how-to-pull-a-git-repo-from-github-with-all-unlinked-commits – Ciro Santilli OurBigBook.com Sep 29 '15 at 09:28

1 Answers1

1

Those wouldn't be "detached HEAD": a detached HEAD is when you check a ref which isn't a branch.

You would like to see reflogs from a GitHub remote repo, but as far as I know, those are not accessible. And reflogs don't get cloned.
See also "git can I view the reflog of a remote?"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks, maybe my terminology is wrong. I pushed a commit, then on my local repos reset back 1, and made another commit (leaving a commit dangling). I then pushed (forcibly). Is the dangling commit accessable on github, can it be checked out? I can't see it on the website – user826840 Feb 08 '13 at 11:15
  • @user826840 I confirm you dangling commit isn't a detached HEAD, just a non-referenced commit, only listed in your reflogs. you can try and put its SHA1 after a `https://github.com/user/repo/commit/xxxx` and see if that returns anything. But if it doesn't, that means commits referenced in GitHub reflogs aren't directly accessible (you might have to contact their support for that). Note that you have that same dangling commit in your reflog of your local repo. – VonC Feb 08 '13 at 11:49
  • @user826840 I understand your new question, but my answer and my previous comment still stand. – VonC Feb 08 '13 at 12:59