Skip to content

Instantly share code, notes, and snippets.

@adavis
Created March 11, 2020 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adavis/685379c415ffad946c60e85076f68036 to your computer and use it in GitHub Desktop.
Save adavis/685379c415ffad946c60e85076f68036 to your computer and use it in GitHub Desktop.
Removes the commit messages that reference merging pull requests from logs
import java.io.File
// Get the passed in file, i.e. "-f some/path" or use the default file name
val file = if (args.contains("-f")) args[1 + args.indexOf("-f")]
else "commit_messages.log"
File("${file}_clean").printWriter().use { out ->
File(file).forEachLine { msg ->
if (msg.startsWith("Merge pull request").not()) {
out.println(msg)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment