0

I'm trying to ignore a line from commit, I've found this question Gitignore single line, and everything works fine if I do:

git config --global filter.gitignore.clean "sed '/#gitignore$/'d"

and annotate code with:

System.out.println("SimpleLineCode"); #gitignore

But I would like to do ignore with this tag //gitignore (because I use Java), so I've wrote:

git config --global filter.gitignore.clean "sed '///gitignore$/'d"

Of course it does not work, and do not know how to do ...

Community
  • 1
  • 1
Michele Lacorte
  • 4,922
  • 5
  • 29
  • 52

1 Answers1

1

The '/' for the Java comment conflicts with the '/' separator of sed. You can escape the / of the comment ("sed '/\/\/gitignore$/'d"). Or use a different separator for sed (which would be more readable). "sed '_//gitignore$_'d"

airos
  • 722
  • 5
  • 13