Skip to content

Instantly share code, notes, and snippets.

@rafaelmaeuer
Last active May 8, 2026 14:51
Show Gist options
  • Select an option

  • Save rafaelmaeuer/f10c48624498b436ff2370b77f79d14b to your computer and use it in GitHub Desktop.

Select an option

Save rafaelmaeuer/f10c48624498b436ff2370b77f79d14b to your computer and use it in GitHub Desktop.
#Create Backup of Main (optional)
git fetch --all --tags
git checkout main
git pull
git branch main-backup-$(date +%Y%m%d)
git push origin main-backup-$(date +%Y%m%d)
# Reset Main to dev:
git checkout main
git reset --hard origin/dev
git push --force-with-lease origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment