Git Diff - Full File View #33773
Replies: 4 comments
-
|
yes, i feel like i'm missing something. i don't want to open a multibuffer with all the changes in my entire project. feels a bit like this is where they should have started?? lol. |
Beta Was this translation helpful? Give feedback.
-
|
I have worked out a solution that will allow us to diff a full file relatively easily. essentially. you will need to have the ideally we would be able to run a task that just diffs the currently open file. so i found it the least painful to just select the file that i want to diff using open the command palette and run {
"label": "git - diff file",
"command": "selected_file=$(git status --porcelain | fzf --accept-nth=2); tmp_dir=/tmp/$(openssl rand -hex 8); mkdir -p $tmp_dir; tmp_file=$tmp_dir/diff; git show HEAD:$selected_file > $tmp_file; zed --diff $tmp_file $selected_file; rm $tmp_file;",
"use_new_terminal": true,
"reveal_target": "center",
"hide": "always"
}this should open an editor where you can select from a list of changes and when you select one it should open up a new editor with the selected file diff you can set this to be on a keybinding by putting this in your {
"context": "workspace",
"bindings": {
"cmd-alt-g": ["task::Spawn", { "task_name": "git - diff file" }],
}
}like i said. cheers |
Beta Was this translation helpful? Give feedback.
-
|
@smitbarmase here is a second solution that will just open the file in the current Editor in a full file diff. put this in your tasks.json. {
"label": "diff",
"command": "git show HEAD:$ZED_RELATIVE_FILE > /tmp/$ZED_FILENAME; zed --diff /tmp/$ZED_FILENAME $ZED_RELATIVE_FILE; rm /tmp/$ZED_FILENAME;",
"reveal": "never",
"hide": "always"
},and this in your keybindings.json {
"context": "Editor",
"bindings": {
"cmd-alt-g": ["task::Spawn", { "task_name": "diff"}],
}
}i also still like having the |
Beta Was this translation helpful? Give feedback.
-
|
ok. so after all that. I was looking through the docs and I actually discovered that Zed already has a action to view the git changes in a full file without any work arounds. I don't think the documentation around this feature is written very well, and that is probably why there are so many repeated discussions requesting this feature. go to the file that you would like to review and run this will show the git changes for the entire file. you can navigate between changes with and the |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
One thing I love about viewing diffs in VSCode compared to Github is that I can view the complete uncollapsed file. This is really useful when trying to get broader context on the changes. Clicking through multiple expand up and downs is a lot of friction.
Beta Was this translation helpful? Give feedback.
All reactions