有没有办法在VS代码中添加当前活动文件中的更改?
我通常只想参考我已更新的特定文件。我发现自己抓住了文件路径并经常运行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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用'。'像
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 justgit commit
it. Thus not needing the full path.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.