有没有办法在VS代码中添加当前活动文件中的更改?

发布于 2025-02-07 12:57:25 字数 92 浏览 1 评论 0原文

我通常只想参考我已更新的特定文件。我发现自己抓住了文件路径并经常运行git添加{filepath}。我可以使用VS代码快捷方式或某种ZSH脚本从命令行获取当前文件路径吗?

I often only want a commit to be in reference to a specific file I've updated. I find myself grabbing the file path and running git add {filepath} a lot. Is there a VS code shortcut or some sort of zsh script I can use to get the current file path from the command line?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

铁憨憨 2025-02-14 12:57:25

您可以使用'。'像git add。它将添加当时具有更改的文件/文件,然后您只需git commit it即可。因此不需要整个路径。

you can use the '.' like git add . it will add the file/files that have changes at that point of time, then you can just git commit it. Thus not needing the full path.

浅唱ヾ落雨殇 2025-02-14 12:57:25

ctrl+shift+p然后git:阶段更改应该是您想要的:

https://github.com/microsoft/vscode/issues/44263#issuecomment-369513103

由于基础vScode命令ID是git> git.git.stage,IT正是命令仅阶段一个文件的更改 - 当前活动文件。

Ctrl+Shift+P then Git: Stage Changes should be what you want:

Reference: https://github.com/microsoft/vscode/issues/44263#issuecomment-369513103

Due to the underlying vscode command ID is git.stage, it is exactly the command only stage the change of one file -- the current active file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文