Skip to content

cryslith/git-recover-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

recover.py

A script to help with recovering an orphaned commit from a remote.

For instance, you force-push your branch away from the commit it was on. You know what the full commit hash was, but you don't have a local copy of the commit. However, the commit is still there on the remote because it hasn't been garbage-collected yet. Unfortunately you can't just run git fetch <commit> because it's not an advertised ref.

This script allows you to create a temporary branch on the remote server pointing at the desired commit, even though you don't have a copy of the commit in question.

Usage

recover.py [email protected]:repo.git temp-recovery-branch 0123456789012345678901234567890123456789

Dependencies

  • dulwich

Alternatives

  • If the remote has certain configuration options set, you may be able to just perform git fetch <commit>. Some remotes may have these set by default.
  • If you're using GitHub, you can use the GitHub API to do the same thing as this script.

About

recover an orphaned commit from a remote

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages