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

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

How to make ‘git diff’ ignore comments

Here is a solution that is working well for me. I’ve written up the solution and some additional missing documentation on the git (log|diff) -G<regex> option. It is basically using the same solution as in previous answers, but specifically for comments that start with a * or a #, and sometimes a space before the … Read more

Difference between git-log and git-whatchanged?

The commit 52f425e1 (August, 30th 2013) mentions: Encourage new users to use ‘log‘ instead. These days, these commands are unified and just have different defaults. ‘git log‘ only allowed you to view the log messages and no diffs when it was added in early June 2005. It was only in early April 2006 that the … Read more

Git create branch from range of previous commits?

You can do this with cherry-pick. If your history of long_branch looks like this: A-B <– master \ C-D-E-F-G-H <– long_branch and you want to move the contents of, say, F through H to a different branch, say, short_branch, which is based off of master: git checkout master -b short_branch which gives A-B <– master, … Read more

automatically stash save/pop changes on git rebase?

Edit: As of Git version 1.8.4, but with an important side bug fixed in Git version 2.0.1, git rebase now has –autostash. You can configure git rebase to use –autostash by default as well, with git config –global rebase.autoStash true. Please note the following sentence from the documentation: However, use with care: the final stash … Read more

Remove a directory permanently from git

The ProGit book has an interesting section on Removing Object. It does end with this: Your history no longer contains a reference to that file. However, your reflog and a new set of refs that Git added when you did the filter-branch under .git/refs/original still do, so you have to remove them and then repack … Read more