Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm referring to the squash feature of git rebase. The developer collapsed years of commits into one before pushing to GitHub, I am wondering if there is a way to keep working on top of the original history privately, and pushing to the "clean" history on GitHub, without having to cherry-pick all new commits for GitHub by hand.


I guess the "easiest" solution would be a clean and separate "github" directory where no work happens and where you just cp all your changes from your actual working directory into.

If they version it, I could also imagine using master as an orphan branch and just cherry-pick the changes between two tags or commits into it.


git replace¹ should be able to do it; otherwise, grafts² work too.

¹ https://git-scm.com/docs/git-replace ² https://git.wiki.kernel.org/index.php/GraftPoint


That is it! Fantastic, thanks!

https://git-scm.com/book/en/v2/Git-Tools-Replace gives the exact example of what I had in mind.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: