Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git cheatsheet #109

Open
kaycebasques opened this issue Jun 20, 2023 · 0 comments
Open

git cheatsheet #109

kaycebasques opened this issue Jun 20, 2023 · 0 comments

Comments

@kaycebasques
Copy link
Owner

kaycebasques commented Jun 20, 2023

git cheatsheet

Delete every branch except main

git branch -D $(git branch | egrep -v "main")

Fix author email in multiple commits

git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Hank Venture"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant