Skip to content

Instantly share code, notes, and snippets.

@oneEyedSunday
Created January 14, 2021 10:05
Show Gist options
  • Save oneEyedSunday/35e5a23bfc55e41583787fa182bdaf38 to your computer and use it in GitHub Desktop.
Save oneEyedSunday/35e5a23bfc55e41583787fa182bdaf38 to your computer and use it in GitHub Desktop.
Pre Push hook to run dotnet builds
#!/bin/sh
branch="$(git rev-parse --abbrev-ref HEAD)"
## custom
BASEDIR=$(dirname "$0")
echo "Running Builds for DotNet Projects before Push for Branch: " $branch
set -e
dotnet build -c RELEASE "$BASEDIR/../../path/to/projects"
# Things you need to do -
# 1. Copy above code
# 2. Go to your project/.git/hooks
# 3. Copy pre-push.sample and rename it to pre-push
# 4. Paste the above code
# 5. Make this file executable - $ chmod +x .git/hooks/pre-commit
@oneEyedSunday
Copy link
Author

Ref here

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