harbor run -t LiteCoder/recover-deleted-branch-mergeharbor download LiteCoder/recover-deleted-branch-mergeRecover a deleted Git branch from the reflog and merge its changes into the current branch, all within a local Git repository.
A setup script /app/setup.sh is provided. Run it first — it creates a local Git repository at /app/repo with the following state:
main branch with an initial commit containing a file README.md.feature/user-auth was created off main, with 3 additional commits that each added or modified files.feature/user-auth branch was then deleted (via git branch -D), but its commits still exist in the reflog.main.Working inside /app/repo, perform the following using Git commands:
feature/user-auth branch.feature/user-auth pointing to that tip commit. After recovery, this branch must contain all 3 commits that were on it before deletion.feature/user-auth into main. The merge commit (or fast-forward result) must be on main.main must contain all files and changes that were introduced by the 3 feature branch commits.After completing all steps, write a JSON report to /app/output.json with the following structure:
{
"recovered_branch": "<name of the recovered branch>",
"tip_commit_hash": "<full 40-char SHA of the recovered branch tip>",
"num_commits_on_feature": <integer, number of commits on feature branch not on original main>,
"merge_commit_hash": "<full 40-char SHA of the merge commit on main, or the tip if fast-forwarded>",
"files_from_feature": ["<list of file paths introduced or modified by the feature branch commits>"]
}
files_from_feature should be a sorted array of relative file paths (e.g., ["auth.py", "config.yaml", "tests/test_auth.py"]).num_commits_on_feature must be an integer.setup.sh after initial execution.feature/user-auth.main, with the merge completed.