--- author: Alvie Rahman date: \today title: Git tags: - linux - programming - git uuid: 8eb93ba5-72e8-4c25-b1f5-02e25408a14d --- # Fix detached head From : ## To Delete Changes ``` git checkout main ``` ## To Keep Changes ``` git branch temp git checkout main git pull . temp git branch -D temp ``` # Retroactively Sign Commits From : 1. ``` git rebase -i HEAD~ ``` 2. Replace `pick` with `reword`: In vim: `:%s/^pick/reword/:wq` 3. Save all commit messages 4. Force push to remote