Skip to content

Instantly share code, notes, and snippets.

View smit9612's full-sized avatar
🏠
Working from home

Smitesh Patel smit9612

🏠
Working from home
View GitHub Profile
@smit9612
smit9612 / pre-commit
Created September 27, 2022 08:16 — forked from candostdagdeviren/pre-commit
Git Pre-Commit hook with SwiftLInt
#!/bin/bash
#Path to swiftlint
SWIFT_LINT=/usr/local/bin/swiftlint
#if $SWIFT_LINT >/dev/null 2>&1; then
if [[ -e "${SWIFT_LINT}" ]]; then
count=0
for file_path in $(git ls-files -m --exclude-from=.gitignore | grep ".swift$"); do
export SCRIPT_INPUT_FILE_$count=$file_path
@smit9612
smit9612 / remove_swift_headers.sh
Created March 3, 2022 04:57 — forked from fe9lix/remove_swift_headers.sh
Xcode: Remove header comments in Swift files
find . -type f -name "*.swift" -not -path "./Pods/*" -exec sed -i '' -e '1,/^import/{/^\/\/.*/d;}' -e '/./,$!d' {} \;

Automatically Prepend a Jira Issue ID to Git Commit Messages

Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message

Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.

  1. Create an empty commit-msg git hook file, and make it executable. From your project's root directory:

     install -b -m 755 /dev/null .git/hooks/commit-msg
    
  2. Save the following script to the newly-created .git/hooks/commit-msg file: