Any good combination of Bash
git diff
to get in one line the only change that I made in my file?
I'm using form Jenkins DSL, and the best that I get so far is this
"${sh(script: "git diff --shortstat", returnStdout: true)}".trim() == "1 file changed, 1 insertion( ), 1 deletion(-)"
But what I would love to have is the "hello world"
text that I just add into one of the files.
CodePudding user response:
If you've got just one hunk,
git diff -U0 | sed 1,/^@@/d
and strip the leading character off.