I’m building a rails rake task to check-in assets and running into issues: errors:
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
Here are the commands in the rake task:
def push_assets
puts "===== Pushing assets to github..."
system("git add public/assets")
system("git commit -m 'production prepared assets' ")
system("git push")
puts "===== Push complete..."
end
Any ideas what is being done wrong in the method? Thanks
Looks like you have already committed the changes. ( did you run this script once before?)
To redo the commit, you can do
git reset HEAD^To make your task idempotent, you can use
git status --porcelainorgit diff --name-onlyor something to see if there are changes to be checked-in in assets. If there are, only then proceed with the commit.