HN user

jimstr

87 karma
Posts1
Comments17
View on HN
OverflowAI 3 years ago

The answer I got with the prompt "You are a git expert. How do I search for a string in dangling commits?"

Was: Dangling commits in Git are often referred to as commits that are no longer reachable from any branch, tag, or the HEAD. These commits usually occur when you create a commit and then move the branch pointer away from it without creating a new branch or tag. They can also occur during rebases or other history rewriting operations.

Git has a garbage collector (`git gc`) that will periodically clean up these dangling commits, but until that happens, they're still in your repository and can be examined.

Unfortunately, Git doesn't provide a direct command to search for a string in dangling commits. However, you can find these commits using the `git fsck` command, which checks the filesystem for errors and dangling commits.

Here is a way to do it manually:

1. List all the dangling commits using `git fsck --lost-found`. This will print out all the dangling commits and store them in `.git/lost-found/commit/`.

2. For each dangling commit, you can search for a specific string using `git log -p <commit-id>` or `git show <commit-id>` and then pipe the output to `grep`.

Here's an example of what this might look like in a script:

  mkdir -p .git/lost-found
  git fsck --lost-found
  for commit in $(ls .git/lost-found/commit/); do
      git show $commit | grep -q "your string here" && echo "Found in commit $commit"
  done
This script will print the IDs of any dangling commits that contain the string "your string here".

Remember to replace "your string here" with the string you are searching for.

*NOTE*: This operation could be time-consuming if you have a lot of dangling commits or a large repository. Also, this approach might not work if the garbage collector has already cleaned up the commits. Make sure to be careful when manipulating Git's internals like this, as it could potentially corrupt your repository if done incorrectly.

CouchDB 3.0 6 years ago

I've gotten the impression that clustered Postgres still isn't very straightforward to run. Do you mind elaborating on your ideal setup and point to some resources?

Thanks!

We made the mistake of buying a 20 core server for running SQL Server 2008, which was fine then, but the upgrade to 2016 would be really expensive due to the new per-core licensing, which means we'll probably be stuck with 2008. Microsoft doesn't leave us much choice than to use Postgres from now on.

Everpix 13 years ago

Registered, downloaded app, attempted to sync "This folder doesn't appear to be on a Mac disk - Please select a different folder". So, why is it not OK that I keep my pictures on my NAS ?