Skip to content

Instantly share code, notes, and snippets.

@cyberswat
Created February 28, 2012 16:41
Show Gist options
  • Save cyberswat/1933558 to your computer and use it in GitHub Desktop.
Save cyberswat/1933558 to your computer and use it in GitHub Desktop.
Jenkins job to manage jenkins configs
# Move into the jenkins directory
cd /var/lib/jenkins
#Add all top level xml files.
git add *.xml
# Add all job config.xml files.
git add jobs/*/config.xml
# Add all user config.xml files.
git add users/*/config.xml
# Add all user content files.
git add userContent/*
# Remove files from the remote repo that have been removed locally.
COUNT=`git log --pretty=format: --name-only --diff-filter=B | wc -l`
if [ $COUNT -ne 0 ]
then git log --pretty=format: --name-only --diff-filter=B | xargs git rm
fi
# Commit the differences
git commit -a -m "Automated commit of jenkins chaos"
# Push the commit up to the remote repository.
git push origin master
@marcusphi
Copy link

Should it really be git log ... --diff-filter=B ?
I get a list of the deleted files when I do git diff ... --diff-filter=D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment