1

The following command works in the console:

 git reset --soft `git rev-parse --abbrev-ref --symbolic-full-name @{u}` && git commit --edit -m "$(git log --format=%B --reverse HEAD..HEAD@{1})"

It is meant to squash the unpushed commits into one and give a chance to edit the message. See Find out which remote branch a local branch is tracking and Squash my last X commits together using Git for more details.

However the following alias fails:

squash-uncomited = reset --soft `git rev-parse --abbrev-ref --symbolic-full-name @{u}` && git commit --edit -m "$(git log --format=%B --reverse HEAD..HEAD@{1})"

✗ git squash-uncomited error: unknown option `abbrev-ref'

usage: git reset [--mixed | --soft | --hard | --merge | --keep] [-q] []

or: git reset [-q] [--] ... or: git reset --patch [] [--] [...]

Why is it so ? What is the difference with aliases and CLI commands ?

Community
  • 1
  • 1
nha
  • 17,623
  • 13
  • 87
  • 133

1 Answers1

1

You've got a full pipeline there, not just an arglist rewrite. Put !git in front of it to have git run the whole thing through the shell again with the first command as git reset.

jthill
  • 55,082
  • 5
  • 77
  • 137