If you want to create a new branch from an older commit (not the latest one), here’s how:
✅ Steps:
Find the commit hash:
git log --onelineExample output:
e3a1b55 Fix security issue6f24a1d Add README34d2a5c Initial commitCreate a branch from that commit:
git checkout -b my-old-branch e3a1b55Note:
- Replace my-old-branch with your desired branch name.
- Replace e3a1b55 with the actual commit hash.
Push the new branch (optional):
git push origin my-old-branch🔄 If you’re already on another branch and don’t want to switch:
You can also do this without switching branches:
git branch my-old-branch e3a1b55Then push:
git push origin my-old-branch

