# Global config
global-config-set:
    git config --global user.name "Hongbo Miao"
    git config --global user.email "3375461+hongbo-miao@users.noreply.github.com"
    git config --global commit.gpgsign true
    git config --global tag.gpgsign true

global-config-show:
    git config --global --list

# Commit
add:
    git add .

commit:
    git commit --message="xxx"

# Branch
branch-show-head:
    cat .git/HEAD

branch-switch:
    git switch branch-name

branch-create-and-switch:
    git switch --create=branch-name

branch-create-by-commit-hash:
    git branch branch-name xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

branch-list-local:
    git branch

branch-list-remote:
    git branch --remotes

# Reset and switch
reset-and-switch-to-main:
    git reset --hard
    git switch main

# Stash and switch
stash-and-to-main:
    git stash
    git switch main
    git stash pop

fetch-branches:
    git fetch --all

rebase:
    git pull --rebase

log:
    git log

status:
    git status

# Recover
recover:
    git reflog --no-abbrev
    git branch branch-name xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Remove secret
remove-secret:
    git log -S xxx
    git log -p -S xxx > git_log.txt
    git filter-repo --replace-text=<(echo 'xxx==>yyy') --refs=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx^..HEAD --force

remove-secret-file:
    git filter-repo --path path/to/secret --invert-paths
    git remote add origin https://github.com/hongbo-miao/hongbomiao.com.git
    git push origin --force --all

# Rewrite Git history to move files to Git LFS
rewrite-git-history-to-move-files-to-git-lfs:
    git lfs track "*.onnx"
    git add .gitattributes
    git lfs migrate import --include="*.onnx" --everything

# Git submodule
submodule-add:
    git submodule add https://github.com/hongbo-miao/hongbomiao.com.git

submodule-remove:
    git rm hongbomiao.com

submodule-move:
    git mv hongbomiao.com submodules/hongbomiao.com

# Git LFS
lfs-install:
    git lfs install

lfs-track:
    git lfs track "*.mp4"

lfs-untrack:
    git lfs untrack "*.mp4"

lfs-status:
    git lfs status

lfs-list:
    git lfs ls-files

# Gitleaks
gitleaks-install:
    brew install gitleaks

gitleaks-detect:
    gitleaks detect --source=. --verbose
