menu

Search By Label

Remove the file and rewrite the history from the commit you did with the removed file(this will create a new commit hash from the file you committed):

there are two ways:

  1. Using git-filter-branch:
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch <path to the file or directory>' --prune-empty --tag-name-filter cat -- --all

  1. Using git-filter-repo:
pip3 install git-filter-repo
git filter-repo --path <path to the file or directory> --invert-paths
Use this following command from your terminal to amend email/name from all commits in a branch:

git filter-branch --env-filter '
OLD_EMAIL="old-test@test.com"
CORRECT_NAME="Oswaldo Pineda"
CORRECT_EMAIL="new-test@test.com"
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
List the stashes:
git stash list

Show the files in the most recent stash:
git stash show

Show the changes in the most recent stash:
git stash show -p

Show the changes in the named stash:
git stash show -p stash@{1}

Or in short:
git stash show -p 1 
With this command, you can check the commit logs in another branch of your project. It's very useful when other coworkers push changes to the main branch.

case main branch: git log -g main
git stash show -p stash@{0}
"git grep" is a Git command used for searching through your Git repository's files for specific text patterns. It's a powerful tool for finding where a particular string or regular expression appears in your codebase. The "git grep" command can be especially helpful for debugging, refactoring, or finding specific references in your code. 

Usage:

git grep [options] pattern