Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Most efficient command to squash git commands

Options
  • 23-11-2021 7:49pm
    #1
    Registered Users Posts: 5,553 ✭✭✭


    Bonus points for readability.


    So each pull request, we have a shedload of commits. Id like to just have 1 overall commit with the difference between HEAD and this


    I'm aware of commit --amend but this isn't an option (long story). Any idears?



Comments

  • Registered Users Posts: 2,022 ✭✭✭Colonel Panic


    Can’t you just view the diff of all commits?

    Anyway, you could soft reset the last N commits and then add and commit all the changes.

    Or interactive rebase let’s you do something similar.

    Problem is, this rewrites history so only really do this locally.



  • Registered Users Posts: 1,994 ✭✭✭lynchie


    If all commits for a pull request are on a branch e.g. bugfix/abc or feature/abc then you can do a git merge -squash onto master which will create one commit? Bitbucket has that feature when merging pull requests and I assume GitHub and gitlab have similar?



Advertisement