Monday, May 23, 2022

git rebase and filter branch

git rebase when email address is incorrect
git log: shows the email addresses are not the git anonymous address
Fix the ones before push by using git rebase -i

Add the following after each pick xxxxx line using vim editor
exec git commit --amend --author="dougc333 <124989 dougc333="" users.noreply.github.com=""> -C HEAD""

Then git will cycle through each entry in the rebase -i display and you write quit each one wo modifying anything. Then you can push with updated anonymous email.

for entries already committed do a git filter branch.

For path with spaces add a backslash git filter-branch -f --tree-filter 'rm -f fabinger_2022/Untitled\ Folder/pbmc_1k_v3_raw_feature_bc_matrix.h5' HEAD --all
Don't add the -r recursive flag to rm -f fabigner_2022/... This can cause an error message "Cannot rewrite branches: You have unstaged changes"

No comments:

Post a Comment