Questions tagged [git-dangling]

Questions concerning dangling commits or blobs in Git. These are commits or blobs without references, which can be lost. For pointers to an invalid memory location, use [dangling-pointer] instead.

14 questions
232
votes
5 answers

What is a dangling commit and a blob in a Git repository and where do they come from?

I'm looking for the basic information on dangling commits and blobs. My repository seems fine. But I ran git fsck for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'. What are these things?…
doub1ejack
  • 10,627
  • 20
  • 66
  • 125
202
votes
11 answers

Listing and deleting Git commits that are under no branch (dangling?)

I've got a Git repository with plenty of commits that are under no particular branch, I can git show them, but when I try to list branches that contain them, it reports back nothing. I thought this is the dangling commits/tree issue (as a result of…
Samer Buna
  • 8,821
  • 9
  • 38
  • 55
66
votes
3 answers

git: dangling blobs

I recently ran git fsck --lost-found on my repository. I expected to see a couple dangling commits, where I had reset HEAD. However, I was surprised to see likely over several thousand dangling blob messages. I don't believe anything is wrong with…
wadesworld
  • 13,535
  • 14
  • 60
  • 93
42
votes
2 answers

How to remove a dangling commit from GitHub?

Yesterday, I pushed to my fork of ConnectBot on GitHub. I pushed once, realized that I hadn't made the change the way I wanted, redid the commit and pushed again. Now, GitHub has both commits: https://github.com/nylen/connectbot/commit/1cd775d –…
We Are All Monica
  • 13,000
  • 8
  • 46
  • 72
12
votes
1 answer

Search for string in dangling commits in Git

The following monstrosity very nicely found a git stash containing the word Upload which is what I was looking for: git fsck --no-reflog | awk '/dangling commit/ {print $3}' | \ while read ref; do if [ "`git show -p $ref|grep -c Upload`" -ne 0 ];…
chx
  • 11,270
  • 7
  • 55
  • 129
9
votes
2 answers

git: Are these dangling commits?

Given at the end is an extracted screenshot from a SourceTree branch tree view (there is a gap in the middle of the screenshot) In that, #1 points to the line which used to be branch 1.7.6.14.X and #2 points to the current status of the same…
Ishan De Silva
  • 935
  • 2
  • 8
  • 22
3
votes
1 answer

git fsck combining --lost-found and --unreachable

I found many interesting posts about git fsck, so I wanted to experiment a little on them. First of all the sources I read before this question: How can I find an unreachable commit hash in a GIT repository by keywords? git fsck: how --dangling…
Marco Luzzara
  • 5,540
  • 3
  • 16
  • 42
3
votes
1 answer

In git, what is the difference between a dangling commit and a dangling blob?

When I do a git fsck, I see a list of dangling objects. Some of these are called dangling commits while others are called dangling blobs. I was wondering as to what the exact difference between these two is.
vedang
  • 3,111
  • 2
  • 24
  • 33
1
vote
0 answers

Why does git fsck --lost-found designate unreachable commits in the reflog as dangling?

I'm doing some work with git gc and I noticed some behavior I don't understand and cannot reconcile in the docs. This pertains to checking for dangling commits with the git fsck utility. Consider the following simple steps: Create a new feature…
silencedogood
  • 3,209
  • 1
  • 11
  • 36
1
vote
3 answers

How to git-commit from a branch to a detached HEAD?

My ref HEAD points the branch foo, that points to the commit 123abc; and I have some staged work. How to git commit that work, moving the HEAD to the newly created commit, but without advancing the branch? (hence: leaving foo point to 123abc) Is it…
Kamafeather
  • 8,663
  • 14
  • 69
  • 99
1
vote
1 answer

Git can't find dangling tree origin

I was running a difference checker between my current files and a backup of the files on my external drive, and I found some differences between a git repo and it's backup. The only differences were some extra files under .git/objects on the left…
woojoo666
  • 7,801
  • 7
  • 45
  • 57
1
vote
1 answer

How to match dangling blobs with file names in Git?

I have yet another example of doing a git rm -rf without an initial commit. (I realized I had added lots of useless files and wanted to add some filters.) Now I am left with 23000 dangling blobs with no tree, but with a complete Git history! I'll…
PaulDj
  • 31
  • 4
0
votes
1 answer

Pruning dangling commits from GitHub fork

I forked a repo on GitHub. I pushed commits (whose commit messages contain references to issues in the original repo) to my fork. I pushed the same commits multiple times while rebasing, rewording, etc. Thus, I've pushed different versions of the…
XDR
  • 4,070
  • 3
  • 30
  • 54
0
votes
2 answers

Do dangling git add blobs get pushed to master repository?

We can recover files, which were once added (but not committed) and later removed using git reset --hard. See Recovering added file after doing git reset --hard HEAD^ When we push in our changes to some upstream repository, Are these blobs also…
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186