Ask git to automatically ignore parts when you add a new source to a project

KimJunkyung 0 Reputation points
2023-02-27T00:49:17.8833333+00:00

I am using visual studio 2022, and when I create a new file, the file is not automatically recognized in the new commit.

In the existing Visual Studio 2017, new files were automatically registered in commit and could be pushed,

Currently, you have to click 'Add ignored files to source control' for each new file.

(I noticed this phenomenon by noticing the red dot next to the newly created 'File.cu' file.)

Is there a setting to automatically register it in commit as before?

User's image

Developer technologies | Visual Studio | Setup
Developer technologies | Visual Studio | Other
{count} votes

1 answer

Sort by: Most helpful
  1. José Antonio Campero Morales 105 Reputation points
    2023-02-28T01:45:23.5233333+00:00

    Hi, the issue you mentioned about new files not being automatically added to the Git repository, this could be due to a change in the default behavior of Visual Studio 2022. You can try the following steps to configure Visual Studio to automatically add new files to Git:

    1. Open the "Team Explorer" window in Visual Studio.
    2. Click the "Settings" button in the toolbar.
    3. In the "Global Settings" tab, check the box next to "Automatically stage new files".
    4. Click "Save" to apply the changes.

    With this setting enabled, new files should be automatically added to the Git repository when you create them in Visual Studio.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.