Error “‘git’ is not recognized as an internal or external command”

You may not have set your PATH correctly to point at your Git installation. You need to add the following paths to PATH: C:\Program Files\Git\bin\ C:\Program Files\Git\cmd\ And check that these paths are correct. You may have Git installed on a different drive, or under Program Files (x86). Correct the paths if necessary. Modifying PATH … Read more

Can I view the reflog of a remote (not remote ref)?

On the off chance that the remote machine is a github repository, First use Github’s Events API to retrieve the commit SHA. curl https://api.github.com/repos/<user>/<repo>/events Identify the SHA of the orphan commit-id that no longer exists in any branch. Next, use Github’s Refs API to create a new branch pointing to the orphan commit. curl -i … Read more

Git is not working after macOS update (“xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools”)

The problem is that Xcode Command-line Tools needs to be updated due to OS update. ** UPDATED for Ventura and updated apple dev download page ** After opening the terminal after a restart, I tried to go to my code, and do a git status, and I got an error and prompt for command line … Read more

How do you detect an evil merge in git?

The easiest thing to do would be to diff the results of your conflict resolution with a merge that auto-resolves conflicts without human intervention. Any automatic resolutions will be ignored, since they will be resolved in exactly the same way. I see two ways of visualizing the possible “evil” resolutions. If you are making this … Read more

How to compute the git hash-object of a directory?

Depending why you wish to do this, the following git command might be useful: git ls-files -s somedirectory | git hash-object –stdin This give a single hash which takes into account the filenames and contents. It works like this. The git ls-files -s …. outputs a list of files and their hashes as text to … Read more