Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCM: Support staging selected changes for *new* files too #78046

rawtaz opened this issue Jul 27, 2019 · 0 comments


Copy link

commented Jul 27, 2019

In a file that was changed, one can go to the SCM sidebar, double click the changed file to get to the changes comparison view, select the lines one want to stage, and then right-click on them and select "Stage selected ranges". This will stage only the lines that were selected.

However, this only works for existing, changed, files. It does not work for new files that hasn't already been added to the repository. For those files, there's no "Stage selected ranges" option available in the menu.

Partially staging a file with git is a matter of git add -p <file> for existing files, but for new files one first has to run git add -N <file> followed by git add -p <file>.

I'm suggesting that support for partially staging new files is added to VS Code - perhaps it's a matter of just running that extra git command behind the scenes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.