show tracked file changes from a higher-level directory

7 views
Skip to first unread message

Erik van Zwol

unread,
Nov 4, 2016, 4:38:07 PM11/4/16
to magit
I'm new to magit. I'm in the status buffer, and I only see changes made to files in the directory of the file from which I got to the status buffer. I am two directory levels down into my project, how do I see changes to a file such as .gitignore, which is in the git root directory, two levels up?

Kyle Meyer

unread,
Nov 4, 2016, 5:24:04 PM11/4/16
to Erik van Zwol, magit
That shouldn't be the case. magit-status should open in the top-level
directory of the git repo unless the subdirectory you're in is itself a
top-level directory for another repo.

So, for example, set up a test repo like so:

mkdir -p /tmp/test-repo/subdir
cd /tmp/test-repo
git init
echo one > one.txt
echo two > subdir/two.txt
git add one.txt subdir/two.txt
git commit -m"first commit"
echo x >> one.txt
echo y >> subdir/two.txt

If you go to /tmp/test-repo/subdir/two.txt in Emacs and call
magit-status, you should be taken to a status buffer for /tmp/test-repo/
that shows the changes in both one.txt and subdir/two.txt. The
default-directory of the status buffer should be /tmp/test-repo/.

--
Kyle

Erik van Zwol

unread,
Nov 4, 2016, 5:38:48 PM11/4/16
to Kyle Meyer, magit
Thanks for your reply.  I did a little more digging, and I think something might be askew with my git-bash on windows, as when I open it up and call git diff on .gitignore, it doesn't actually have any changes to show.  not sure what's going on there.

 - Erik
Reply all
Reply to author
Forward
0 new messages