Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Most efficient command to squash git commands

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


    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,065 ✭✭✭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,033 ✭✭✭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
Advertisement