I know how to ignore specific lines completely in git using gitattributes (see How to tell git to ignore individual lines, i.e. gitignore for specific lines of code), but how would I go about ignore changes to a specific line?
I assume we can use a filter very similarly, but I don't know what my sed script should do to ignore the changes to the line.
For a practical example, I am writing up a C# library that needs a specific build output path depending on the project it's used in as a submodule. Thus, it has to be configured manually wherever it's being used, but that change must not be commited to the library itself.
Original Library.csproj:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
...
<OutputPath>bin\Debug\</OutputPath>
...
</PropertyGroup>
Submodule Library.csproj:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
...
<OutputPath>..\Target\</OutputPath>
...
</PropertyGroup>
How do I get git to ignore the change to this line?
After a few hours on this, here is where I have arrived, combining the two answers I have at this time and some supplementary research for my solution:
Answer to the question itself: Not really possible to ignore changes to a line
You can't ignore changes to a single line. The page I referenced in my question only discusses how to DELETE a single line from a commit, not IGNORE CHANGES. The best alternative would be to hook something that would REPLACE the line with something else when you push, and having to put back what was initially removed when you pull, which is possible but very tedious. (See "clean" and "smudge" in the Git Attributes Documentation)
As for the solution I opted to use for my build issues, I decided to write a small batch script, run as Post Build Event, that copies the files built to a target directory, whose path is defined in a file ignored from git to allow modularity.
Another nice solution, proposed by Luis Silva, is to use a .csproj.template file and add .csproj to the gitignore. The template can be copied and modified to fit the needs of the implementation.