Git Branch vs Stash vs Tree

This seems like an odd workflow (though an understandable one). Most people would use git branches for switching between feature or bugfix branches. (So long as you don't have to work on them in parallel.)

This workflow could definitely benefit from setting CARGO_TARGET_DIR to a shared location (or just putting multiple checkouts into a workspace) to allow sharing of work.

I've set my target dir to a shared location a good while ago -- basically a poor man's sccache. It works really well, and I just have to remember to run a cargo clean about every six weeks whenever I run rustup update.

I don't really like having to create WIP commits just to switch over to work on another issue. Yeah, I suppose I could just run git commit -am "WIP", switch to another branch, then run git reset --soft HEAD^1 when I switch back, but git worktree seems like a better workflow to me - I can have each workspace open in its own editor and switch between them by just tabbing between windows rather than having to change the state of my worktree.

1 Like

Are you looking for git stash?

1 Like

git stash would be irritating if you're juggling more than 2 branches at a time.

1 Like

Wouldn't $BRANCHNAME WIP work? That would be pretty clear to me.

I don't know, seems like extra steps and bookkeeping over just sticking the stash directly into the commit history.

I'm happy with my git worktree workflow, anyway. :slight_smile:

(tbh I wasn't aware that git-worktree was a thing prior to this. Git is absolutely massive.)

3 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.