Execute a command to commit and push the source code to GitHub in the Elixir/Phoenix project

Setup

git config --global alias.add-commit '!git add -A && git commit'

Module

defmodule SourceCodeJob do
  def commit_all(message) do
    System.cmd("git", ["add-commit", "-m", message], into: IO.stream(:stdio, :line))
    System.cmd("git", ["push"], into: IO.stream(:stdio, :line))
  end
end

Execute

SourceCodeJob.commit_all("My commit message")

Cover Photo