Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 532 Bytes

cheatsheet-git.md

File metadata and controls

38 lines (26 loc) · 532 Bytes

git

Remove file from history:

git filter-repo --force --invert-paths --path PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA

Force reset to remote branch:

git reset --hard origin/main

Rebase branch without commit time change

git rebase --committer-date-is-author-date --onto <new-parent> <old-parent>

Combine last 3 commits into one

git rebase -i HEAD~3

Git pull without fetch submodules

git pull --no-recurse-submodules

Modify last commit message

git commit --amend