Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Most efficient command to squash git commands

  • 23-11-2021 07:49PM
    #1
    Registered Users, Registered Users 2 Posts: 5,762 ✭✭✭


    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, Registered Users 2 Posts: 2,062 ✭✭✭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, Registered Users 2, Paid Member Posts: 2,032 ✭✭✭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