I am trying to extract the ONLY lastest commit changes to file

Hi there,
I will need to extract the commit changes to another out put file. could you pls help me how I would do that.

Here is the groovy script: any pointers would help.

println “Get Commit histroy:—>”
//git log –
//def command = “git log --name-only”

// this command is used to get the profile commit details.
println “\n”;

def command = “git log --oneline profile.xml”

def proc = command.execute()

String str= “${proc.in.text}”;
println str;

println “****************************************”
// This script is used to get the commit differences:

def command1 = “git diff 1715be1 profile.xml”
def proc1 = command1.execute()

println “\n”;

String str1= “${proc1.in.text}”;
println str1;

Thank you,

Hi and welcome @rao645 ! I was wondering if you’re still having these issues? If so, could you maybe try some of the solutions proposed in this SO answer? https://stackoverflow.com/a/22412252

I think it covers what you’re looking for. If not, please do feel free to post back here. If you’ve solved it in the meantime, you can maybe share your solution here so other people can use that as well!