arxanas / git-branchless

High-velocity, monorepo-scale workflow for Git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Explain alternative to stashing

hkrutzer opened this issue · comments

Wiki page

https://github.com/arxanas/git-branchless/wiki/Workflow:-stashing

Subcommand

No response

Description

Hi,

The page on stashing says

TODO: explain an alternative to stashing commits with git-branchless.

I don't actually using stashing because I always forget the flags to include everything, instead of just staged changes. I also want the changes to stay on the branch I am on, and I like that they're recorded. Instead I have these aliases:

wip = "!git add .; git commit -m WIP"
unwip = "![[ $(git log -1 --format=%B) == WIP ]] && git reset --soft HEAD^ && git status || echo HEAD is not a WIP commit"

Generally I use this when I have some code that I never want to publish, for example containing debug statements, but I need to do something on a different branch.
It would be great if you could expand on how to achieve this with git-branchless.

commented

Some notes for this workflow:

  • git record commits all tracked files by default if none are staged, which might simplify the wip alias.
  • I personally find it hard to keep track of WIP commits without a description, so my WIP commit messages are typically something like "WIP: goat teleportation".
  • unwip is an interesting workflow - I typically git amend my WIP commits until they become squash-into-parent-able, or submittable with a git reword.
  • jj WIP commit / stashing workflow is very intutive (WIP commits are automatically created, jj edit is effectively unwip) and should be quite familiar to git-branchless users.