git
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
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
Is it still possible to restore deleted untracked files in git?
Some better IDEs keep track of your files as a local history. If you removed files externally (say, git reset) you should be able to click in your IDE on parent directory and choose “Compare with local history”. I used this feature successfully in PHPStorm IDE when my untracked files got wiped out by some … Read more
Git: untrack a file in local repo only and keep it in the remote repo
You could update your index: cd /root/folder/of/your/repo git update-index –assume-unchanged nbproject/project.properties and make sure it never shows as “updated” in your current repo. That means it won’t ever be pushed, but it is still present in the index. (and it can be modified at will in your local working tree). to revert that state (from … Read more
Git: Ignore files for public repository, but not for private
I will second the submodule answer, but try to provide some clarification. First, git does not deal with files but with commits. There is no way to filter files or paths in a branch because a branch is really a pointer to a commit. When you exclude or ignore you are just keeping files from … Read more
How to invert `git log –grep=` or How to show git logs that don’t match a pattern
This will be possible with Git 2.4+ (Q2 2015): see commit 22dfa8a by Christoph Junghans (junghans): log: teach –invert-grep option “git log –grep=<string>” shows only commits with messages that match the given string, but sometimes it is useful to be able to show only commits that do not have certain messages (e.g. “show me ones … Read more
git difftool to give directory compare?
Update June 2012 (2 and an half years later): This (comparing directories instead of file-by-file) seems to be soon available: See [ANNOUNCE] Git 1.7.11.rc1: “git difftool” learned the “–dir-diff” option to spawn external diff tools that can compare two directory hierarchies at a time after populating two temporary directories, instead of running an instance of … Read more
Git slows down Emacs to Death – How to Fix this?
There’s a built-in profiler called ELP. You can try something like M-x elp-instrument-package, enter “vc”, and then try finding a file. Afterwards, M-x elp-results will show you a profile report. (Note that if the time is instead being spent in non-vc-related functions, this technique will not show it, but you can instrument further packages if … Read more