Recovering Deleted Git Stashes
This note describes how to identify and recover deleted stashes.
This note describes how to identify and recover deleted stashes.
Output Commit History
Use the following command to output commit history and identify dangling commits:
git fsck | awk '/dangling commit/ {print $3}' >> commit_list.txtThe output will look something like this:
dangling commit bfebf68feeebf07a86d7e3e4da77962de67c14eedangling commit 86f4aec78bd51c80b0fd2d5d83963a2259dc72b4dangling commit 48fd9f8f97a577bc8a87b133f6e1dd789a692bd0dangling commit 64ff8c33fb878afb8bf5c99c1b8d8fdfaa1b1f3cdangling commit bdff88e13803e6c7737691aa1fb6f1e038321966Output Commit Summaries
To review commit details, run the following script:
#!/bin/bash
while read linedo git show $linedone < ./commit_list.txtThis will display summaries of the dangling commits:
commit bfebf68feeebf07a86d7e3e4da77962de67c14eeMerge: b046240 5ee731aAuthor: Takahiro Iwasa <iwasa.takahiro@wasabee.dev>Date: Fri Feb 12 22:01:47 2016 +0900
On develop: 0212Restore Selected Commits
Carefully review the commit summaries and use the date, time, and commit message to identify the commits you wish to restore.
Finally, restore the identified commits using git cherry-pick. Use the following command:
git cherry-pick -n -m1 <YOUR_COMMIT_ID>Related posts
Sign in with Slack Using Cognito User Pools and OIDC
This note describes how to federate Cognito user pools with Slack using OIDC to implement "Sign in with Slack".
Deploying FastAPI on AWS Lambda with Lambda Web Adapter
This example guides you through the process of developing API backends with FastAPI using Lambda Web Adapter.
API Gateway WebSocket: Implementing a Mock Integration
This note describes how to build an API Gateway WebSocket endpoint using mock integration.
Uploading to S3 Through CloudFront Pre-Signed URLs
CloudFront signed URLs let you upload to S3 through a custom domain—useful when direct S3 pre-signed URLs are not an option.
AWS EventBridge Scheduler: Automate EC2 Scheduling with Ease
This note describes how to automate starting and stopping of EC2 instances using EventBridge Scheduler.
