Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get my git-integrated Kaleidoscope to display all files that are about to be committed?

Tags:

git

diff

I'm using command-line git and Kaleidoscope to perform my code reviews. When I merge a branch into another and type

git difftool

Kaleidoscope only displays changes that are 'not staged for commit' and don't display 'unmerged paths' or 'changed to be committed'.

The command-line displays the rest of the stuff.

Any idea why?

This is my ~/.gitconfig

[user]
        name = Dirty Henry
        email = [email protected]
[core]
        excludesfile = /Users/dirty/.gitignore_global
        editor = mate
[difftool "Kaleidoscope"]
        cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\"
[mergetool "sourcetree"]
        cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
        trustExitCode = true
[diff]
        tool = Kaleidoscope
[credential]
        helper = osxkeychain
[difftool]
        prompt = false
like image 275
Dirty Henry Avatar asked Aug 01 '12 17:08

Dirty Henry


People also ask

How to show all the committed files in Git?

In Git, we can use git show commit_id --name-only to list all the committed files that are going to push to the remote repository. P.S The git status didn’t show the committed files.

How to view all the files managed by a git repository?

The files managed by git are shown by git ls-files. Check out its manual page. The accepted answer only shows files in the current directory's tree. To show all of the tracked files that have been committed (on the current branch), use --full-tree makes the command run as if you were in the repo's root directory. -r recurses into subdirectories.

How do I list all files currently being tracked in Git?

If you want to list all the files currently being tracked under the branch master, you could use this command: git ls-tree -r master --name-only If you want a list of files that ever existed (i.e. including deleted files): git log --pretty=format: --name-only --diff-filter=A | sort - | sed '/^$/d'

How do I list all changes between two commits in Git?

If you want to list all changed files between two commits use the git diff command: git diff --name-only <start-commit>..<end-commit>. You can also use --name-status to include the added, modified or deleted change next to each file: git diff --name-status <start-commit>..<end-commit>.


1 Answers

Short answer: what you want to be typing on the command line is git difftool HEAD, not git difftool.

Long answer: This is normal git behavior, and it's kind of frustrating if you don't realize what's happening. I'm not sure why the command-line diff is working as you expect, but both git diff and git difftool should be performing similarly as per the git man page:

git diff [--options] [--] [<path>...] This form is to view the changes you made relative to the index (staging area for the next commit). In other words, the differences are what you could tell git to further add to the index but you still haven't. You can stage these changes by using git-add(1).

So git diff and git difftool should show you only unstaged changes.

If you want to see staged changes, you should use git diff --cached and git difftool --cached instead:

git diff [--options] --cached [<commit>] [--] [<path>...] This form is to view the changes you staged for the next commit relative to the named <commit>. Typically you would want comparison with the latest commit, so if you do not give <commit>, it defaults to HEAD. If HEAD does not exist (e.g. unborned branches) and <commit> is not given, it shows all staged changes. --staged is a synonym of --cached.

Finally, if you want to see both staged and unstaged changes, you use the third form, git diff HEAD or git difftool HEAD:

git diff [--options] <commit> [--] [<path>...] This form is to view the changes you have in your working tree relative to the named <commit>. You can use HEAD to compare it with the latest commit, or a branch name to compare with the tip of a different branch.

like image 91
Simone Manganelli Avatar answered Nov 01 '22 10:11

Simone Manganelli