How to avoid tons of commits when debugging Heroku app

前端 未结 3 1060
你的背包
你的背包 2020-12-14 21:04

While trying to sort out bugs with apps on Heroku, I usually end up with a bunch of Git commits related to the bug fixing process, as I need to commit the updates in order t

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-14 21:25

    You don't really want to clean up these commits. What you want to do instead is encapsulate them in a merge commit:

    • Check out master -- git checkout master
    • Create a branch for your topic -- git checkout -b my-cool-bugfix
    • Do the work on your branch
    • When ready, git checkout master again, then do a non-fast-forward merge. This is essential: forcing non-fast-forward with the --no-ff option means that a merge commit will always be created. In this case, the command would be git merge --no-ff my-cool-bugfix.
    • You now have one merge commit on master that encapsulates all your branch commits, but retains the commit history so that Git's history analysis tools don't break.
    • When you've tested the fix, git push heroku.

提交回复
热议问题