Skip to content

Instantly share code, notes, and snippets.

@gijigae
Last active February 8, 2025 19:47
Show Gist options
  • Select an option

  • Save gijigae/7f9f6bf97c046145e861d1098bc5aa54 to your computer and use it in GitHub Desktop.

Select an option

Save gijigae/7f9f6bf97c046145e861d1098bc5aa54 to your computer and use it in GitHub Desktop.
Reapply local changes made for Dify
#!/bin/bash
set -e
DIFY_PATH="./dify"
cd "$DIFY_PATH" || { echo "Dify path '$DIFY_PATH' not found."; exit 1; }
# Check the local changes
if [[ $(git status --porcelain) ]]; then
# Stash local changes so that they can get reapplied later
git stash push -u -m "Local changes before update $(date +%Y-%m-%d:%H:%M:%S)"
STASH_APPLIED=1
else
echo "No local changes to stash."
fi
# Pull latest changes with rebase
if ! git pull --rebase; then
echo "Failed to pull the latest changes."
exit 1
fi
if [ "$STASH_APPLIED" == "1" ]; then
if git stash pop; then
echo "Successfully reapplied local changes."
else
echo "There were conflicts while reapplying local changes."
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment