git-squash icon indicating copy to clipboard operation
git-squash copied to clipboard

Allow to append all squashed commits informations

Open Pierstoval opened this issue 10 years ago • 7 comments

This fixes #2

Example:

$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --branches --date=short
* cdc0d75 - (HEAD, master) commit 9 (6 seconds ago) <Alex Rock Ancelet>
* b94aedf - commit 8 (6 seconds ago) <Alex Rock Ancelet>
* 3c129a7 - commit 7 (6 seconds ago) <Alex Rock Ancelet>
* ac0f50d - commit 6 (6 seconds ago) <Alex Rock Ancelet>
* 57901ac - commit 5 (6 seconds ago) <Alex Rock Ancelet>
* bf8b746 - commit 4 (7 seconds ago) <Alex Rock Ancelet>
* 8ff7dbb - commit 3 (7 seconds ago) <Alex Rock Ancelet>
* 072a8a1 - commit 2 (7 seconds ago) <Alex Rock Ancelet>
* b6388ec - commit 1 (7 seconds ago) <Alex Rock Ancelet>
* f8d4ab2 - commit 0 (7 seconds ago) <Alex Rock Ancelet>

Executed this:

$ git squash -m "Squash'em'all !" -a HEAD~9
 git squash -m "Squash'em'all " -a HEAD~9
 /usr/local/bin/git-squash: line 64: [: missing `]'
 Warning: Forgetting local history. To revert, use:
   $ git reset --hard cdc0d75 
 Squashing...
 [detached HEAD fb70f68] commit 1
  Date: Tue Apr 21 12:27:05 2015 +0200
  9 files changed, 9 insertions(+), 9 deletions(-)
 Successfully rebased and updated refs/heads/master.
 Updating commit message
 [master c1cb13a] Squash'em'all

And after a git log:

$ git log -1
commit c1cb13ad0527257e30aec99334de3ebdb93672bf
Author: Alex Rock Ancelet <[email protected]>
Date:   Tue Apr 21 12:27:05 2015 +0200

    Squash'em'all

    [cdc0d75] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 9

    [b94aedf] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 8

    [3c129a7] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 7

    [ac0f50d] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 6

    [57901ac] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 5

    [bf8b746] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 4

    [8ff7dbb] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 3

    [072a8a1] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 2

    [b6388ec] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
    commit 1

What do you think ?

Pierstoval avatar Apr 21 '15 10:04 Pierstoval

I hope to look at this soon, but am preoccupied by Major Life Events. Feel free to bump in a couple of weeks

On 21 April 2015 at 20:30, Alex Rock Ancelet [email protected] wrote:

This fixes #2 https://github.com/jnothman/git-squash/issues/2

Example:

$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abb rev-commit --date=relative --branches --date=short* cdc0d75 - (HEAD, master) commit 9 (6 seconds ago) <Alex Rock Ancelet>* b94aedf - commit 8 (6 seconds ago) <Alex Rock Ancelet>* 3c129a7 - commit 7 (6 seconds ago) <Alex Rock Ancelet>* ac0f50d - commit 6 (6 seconds ago) <Alex Rock Ancelet>* 57901ac - commit 5 (6 seconds ago) <Alex Rock Ancelet>* bf8b746 - commit 4 (7 seconds ago) <Alex Rock Ancelet>* 8ff7dbb - commit 3 (7 seconds ago) <Alex Rock Ancelet>* 072a8a1 - commit 2 (7 seconds ago) <Alex Rock Ancelet>* b6388ec - commit 1 (7 seconds ago) <Alex Rock Ancelet>* f8d4ab2 - commit 0 (7 seconds ago) <Alex Rock Ancelet>

Executed this:

$ git squash -m "Squash'em'all !" -a HEAD~9 git squash -m "Squash'em'all " -a HEAD~9 /usr/local/bin/git-squash: line 64: [: missing `]' Warning: Forgetting local history. To revert, use: $ git reset --hard cdc0d75 Squashing... [detached HEAD fb70f68] commit 1 Date: Tue Apr 21 12:27:05 2015 +0200 9 files changed, 9 insertions(+), 9 deletions(-) Successfully rebased and updated refs/heads/master. Updating commit message [master c1cb13a] Squash'em'all

And after a git log:

$ git log -1 commit c1cb13ad0527257e30aec99334de3ebdb93672bf Author: Alex Rock Ancelet [email protected] Date: Tue Apr 21 12:27:05 2015 +0200

Squash'em'all

[cdc0d75] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 9

[b94aedf] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 8

[3c129a7] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 7

[ac0f50d] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 6

[57901ac] Tue Apr 21 12:27:06 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 5

[bf8b746] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 4

[8ff7dbb] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 3

[072a8a1] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 2

[b6388ec] Tue Apr 21 12:27:05 2015 +0200 - Alex Rock Ancelet <[email protected]>
commit 1

What do you think ?

You can view, comment on, or merge this pull request online at:

https://github.com/jnothman/git-squash/pull/3 Commit Summary

  • Allow to append all squashed commits informations

File Changes

  • M git-squash https://github.com/jnothman/git-squash/pull/3/files#diff-0 (29)

Patch Links:

  • https://github.com/jnothman/git-squash/pull/3.patch
  • https://github.com/jnothman/git-squash/pull/3.diff

— Reply to this email directly or view it on GitHub https://github.com/jnothman/git-squash/pull/3.

jnothman avatar Apr 21 '15 14:04 jnothman

About 9 months later, would you check it out? :smile:

I've already been using this for months and I find it very good, there's also docs on it, so if you still need it ;)

Oh, and happy new year ;)

Pierstoval avatar Jan 01 '16 15:01 Pierstoval

This has taken me a very long time for me to look at, indeed. It looks like a good idea. Now I just need to sit down with the code and check that you've dotted your is and crossed your ts! Thanks for the contrib!

jnothman avatar Apr 27 '17 11:04 jnothman

Do you really think it appropriate to keep the commit sha in the summary? This seems like it contradicts the idea of squashing.

jnothman avatar Apr 27 '17 11:04 jnothman

Sometimes it can be useful when you squash from a forked repository.

But since the time I made this PR, I've been using this squash command without keeping the summary at all, I guess it's a question about usage.

But yes, if you think it's too redundant to keep the commit hash, I may remove it, it does not bring a lot of new information to the commit actually, so it's relevant to me :)

Pierstoval avatar Apr 27 '17 11:04 Pierstoval

Aaaand, it's done, and squashed :)

Pierstoval avatar Apr 27 '17 11:04 Pierstoval

Still using this version of git-squash from time to time, any news about merging it? 😉

Pierstoval avatar May 30 '18 23:05 Pierstoval