meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
git:rewrite [2022/02/24 14:50] – niziak | git:rewrite [2024/04/04 11:47] (current) – niziak | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Rewrite history ====== | ====== Rewrite history ====== | ||
+ | |||
+ | ====== change initial commit ====== | ||
+ | |||
+ | <code bash> | ||
+ | git rebase -i --root | ||
+ | </ | ||
+ | |||
+ | ====== reformat code in commits ====== | ||
+ | |||
+ | ===== git rebase ===== | ||
+ | |||
+ | <code bash> | ||
+ | git rebase main -x 'make clang-reformat && git commit --amend' | ||
+ | </ | ||
+ | |||
+ | ===== git-filter-repo ===== | ||
+ | |||
+ | <code bash> | ||
+ | wget https:// | ||
+ | chmod +x lint-history | ||
+ | </ | ||
+ | Apply patch from https:// | ||
+ | |||
+ | <code bash> | ||
+ | ./ | ||
+ | --refs main..feeat-clang2 \ | ||
+ | --relevant ' | ||
+ | clang-format-16 -i | ||
+ | </ | ||
+ | |||
+ | ====== reword commits ====== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | Following will automatically execute default editor for every commit: | ||
+ | <code bash> | ||
+ | git rebase origin/ | ||
+ | </ | ||
====== Remove files from history (rewriting) ===== | ====== Remove files from history (rewriting) ===== | ||
Line 21: | Line 59: | ||
<code bash>git filter-repo --path-rename ' | <code bash>git filter-repo --path-rename ' | ||
+ | |||
+ | |||
+ | ====== Move from root to subdir ====== | ||
+ | |||
+ | <code bash>git filter-repo --path-rename ': | ||
====== apply dos2unix ====== | ====== apply dos2unix ====== |