Git ले तपाइलाई इतिहास पुनः लेख्न दिन्छ — commits सँशोधन, rebase गर्न, squash गर्न, वा हटाउन — commits सफा गर्न वा समस्याहरु ठीक गर्न। यो शक्तिशाली छ तर सावधानीपूर्वक गर्नु पर्छ: साझा इतिहास पुनः लेख्दा गम्भीर समस्याहरु हुन्छन्, त्यसैले यसको वरिपरि नियमहरु महत्त्वपूर्ण छन्।
इतिहास पुनः लेख्ने तरिकाहरु
git commit --amend → modify the most recent commit (message or content)
git rebase -i → squash, reword, reorder, edit, drop commits (interactive)
git rebase <branch> → replay commits onto another base (linear history)
git reset → move the branch pointer (discard/uncommit)
git filter-repo → rewrite MANY commits (remove a file/secret from all history)
→ All of these change commit HASHES (rewriting = creating new, different commits).
