User Tools

Site Tools


ubuntu:git:git_fsck

Ubuntu - GIT - git fsck

This is GIT's file system checker, which makes sure that every available object is reachable and valid.

When references like branches are deleted, the objects (e.g., Commit objects) aren't usually deleted but aren't reachable.

This is useful (as with reflog) to recover deleted branches, but especially useful with recovering remote branches.

git branch
  bug-fix
  master
* new-feature
 
git checkout master
Switched to branch 'master'
 
git branch
  bug-fix
* master
  new-feature
 
git rev-parse --short new-feature
c033e5e
 
git branch -D new-feature
Deleted branch new-feature (was c033353).
 
git fsck --lost-found
Checking object directories: 100% (256/256), done.
dangling commit 4113bc5d0d3ad3047e76b0ea67e8d8bc82f74821
dangling commit c033e5e21e2a89920a1a8b0a4e31d16b423e420b
dangling blob c700db9f3785252428d20bb87f09a33d634dd9f1
dangling tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
dangling commit ff70d170cb69f044fb595d06ce90a3c6962bfe82
 
git branch
  bug-fix
* master
 
git branch new-feature c033
 
git branch 
  bug-fix
* master
  new-feature
ubuntu/git/git_fsck.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki