Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add Option to Squash Selected Contiguous Commits #408

Closed
thomaschampagne opened this issue Aug 25, 2024 · 11 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@thomaschampagne
Copy link
Contributor

Hi there!

First of all, I want to express my appreciation for the incredible work you've done with this project! I've been searching for a well-designed, open-source Git client across Windows, macOS, and Linux for years. This tool is a breath of fresh air compared to others like SmartGit, Sublime Merge, SourceTree, LazyGit, GitHub Desktop, Gitkraken, ...

I was wondering if there's any plan to add an option to squash selected contiguous commits via a right-click menu? This feature is available in several other clients like SmartGit, GitHub Desktop, LazyGit, and Fork (if I recall correctly).

Example:

Here's a quick example of the usage from GitHub Desktop:

Animation

This feature would be incredibly useful for streamlining commit history and making the tool even more powerful.

Thanks again for your amazing work, and I look forward to hearing your thoughts on this feature request!

Best regards,

Thomas

@love-linger love-linger self-assigned this Aug 25, 2024
@love-linger
Copy link
Collaborator

love-linger commented Aug 25, 2024

There are several ways to do that.

  • You can use Interactive Rebase context menu item of selected commit. For example:
image
  • You can use Squash context menu item of commit if the target commits are starts with HEAD
  • You can use Reset context menu item of the selected commit with soft mode. The re-commit the contents

@love-linger love-linger added the question Further information is requested label Aug 25, 2024
@love-linger
Copy link
Collaborator

BTW, you can enable Amend option while committing if you want amend your HEAD commit

@thomaschampagne
Copy link
Contributor Author

@love-linger Thanks for your response. I had tested interactive rebase before posting this issue :).

My main concern is actually to find a way to quickly squash multiple consecutive commits without the need to manually select each one or figure out the right parent commit to start an interactive rebase for this purpose. The current method requires squashing manually each commit individually except for the last one which is the direct child of parent commit selected for interactive rebase (the one we have to figure out).

The feature can essentially be summed up as: "A convenient way to squash/fixup a large selection of commits."

Thanks again for your amazing work !

Thomas

@love-linger
Copy link
Collaborator

But usually, the historical commit view is very complex, such as:
截屏2024-08-25 20 45 36
it mixes the commits both in current branch and other branches. It need more options to select the commits you want to squash via Ctrl+Click.

@love-linger
Copy link
Collaborator

love-linger commented Aug 25, 2024

I'd like add a context menu item - Squash Commits Since This, for the commit that meets the following conditions:

  • Contains in current branch
  • Not the current HEAD commit

It will squash all commits since selected commit in current branch (include selected) into one commit

@love-linger love-linger added enhancement New feature or request and removed question Further information is requested labels Aug 25, 2024
@love-linger
Copy link
Collaborator

截屏2024-08-25 21 46 05

You can try it from https://github.com/sourcegit-scm/sourcegit/actions/runs/10547463901

@thomaschampagne
Copy link
Contributor Author

thomaschampagne commented Aug 25, 2024

I tested ! It's a nice quick win !! THANKS !!!

About formulation what about:

  • "Squash child commits into this one" ?
  • "Squash child commits to here"?

Adding "child" word helps to refer to "Contains in current branch" & "Not the current HEAD commit" IMO.

To thanks you, I can provide you a fr_FR.axaml file if you want (I seen that french translations are missing, and I'm french)

Thanks again for your work !

@love-linger
Copy link
Collaborator

thanks very much.

there is already a French translation in 'develop' branch.

@thomaschampagne
Copy link
Contributor Author

there is already a French translation in 'develop' branch.

Do you need a review?

@love-linger
Copy link
Collaborator

I think they have done this job. See #405.

@thomaschampagne
Copy link
Contributor Author

I think they have done this job. See #405.

It's not completely translated. Many values remains in full english. I will give a look ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants
@thomaschampagne @love-linger and others