Skip to content

Conversation

@robert7k
Copy link
Contributor

This feature allows users to add a new, untracked file to .gitignore by using the context menu in the git panel.

Demo screen shot

Release Notes:

  • Added feature to add a new file to .gitignore
New files in the git panel can be added to .gitignore via the conext
menu.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Sep 12, 2025
@AlvaroParker
Copy link
Contributor

Nice idea, wouldn't it be better to use Project::save_buffer or something similar that allows to also modify the .gitignore file on remote?

pub fn save_buffer(&self, buffer: Entity<Buffer>, cx: &mut Context<Self>) -> Task<Result<()>> {
self.buffer_store
.update(cx, |buffer_store, cx| buffer_store.save_buffer(buffer, cx))
}

@robert7k
Copy link
Contributor Author

Nice idea, wouldn't it be better to use Project::save_buffer or something similar that allows to also modify the .gitignore file on remote?

Great suggestion, thanks!

I adjusted the code accordingly.

Copy link
Member

@cole-miller cole-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening a PR! +1 to having this as a feature, but I think we could improve the handling of the .gitignore file a bit. Right now the code always opens/creates the .gitignore at the worktree root, which is not necessarily the same as the repository root, since you can open a parent or child directory of a git repository in Zed. We should make sure to edit the .gitignore at the repo root.

@robert7k
Copy link
Contributor Author

robert7k commented Oct 3, 2025

Thanks for the review and the suggestion. I changed it accordingly.

@robert7k robert7k requested a review from cole-miller October 3, 2025 20:41
Copy link
Member

@cole-miller cole-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looking good, just a couple of small things and this should be ready to merge!

@robert7k robert7k requested a review from cole-miller October 6, 2025 18:46
Copy link
Member

@cole-miller cole-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like just a lint or two that needs fixing now.

@cole-miller cole-miller enabled auto-merge (squash) October 7, 2025 01:13
auto-merge was automatically disabled October 7, 2025 06:53

Head branch was pushed to by a user without write access

@robert7k robert7k requested a review from cole-miller October 7, 2025 07:48
@cole-miller cole-miller merged commit 681c198 into zed-industries:main Oct 8, 2025
22 checks passed
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Oct 11, 2025
This feature allows users to add a new, untracked file to `.gitignore`
by using the context menu in the git panel.

<img width="300" alt="Demo screen shot"
src="https://github.com/user-attachments/assets/3f2402fb-9337-42f8-939f-dac12ca09518"
/>

Release Notes:

- Added feature to add a new file to `.gitignore`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

3 participants