Working on a shared project I often end up with a number of changes not suited for inclusion in the main branch.

These changes includes configuration of my development environment, code changes that make it more convenient to run and debug the code locally to my preferences, and changes not ready for review and merging.

To support this, I have evolved the following git workflow:

- All my changes lives on a branch called 'wip' (Work in progress).

- This branch is regularly rebased on top of our 'develop' branch.

- I heavily do interactive rebase of the branch to reorder changes and squashing updates to my configuration and convenience changes.

- When I need to share my work, I create a regular feature branch based on 'develop' cherry-picking the relevant commits.

- Then I push the feature branch to get it reviewed and merged.

To support this I have a single alias so I can write:

$ git wip

instead of

$ git log --oneline origin/develop..wip

to see which changes I have in my workspace.

Actually, we're not quite consistent naming our development branch. So what I have is an symbolic ref pointing to the branch we do development on:

$ git symbolic-ref refs/heads/wip-base refs/remote/origin/develop

and then my 'git wip' alias actually says "log --oneline wip-base..wip"

I know that this workflow probably isn't to everybody's liking.

But for me the alternative seems to do at lot of stashing often getting lost in my stash.

This allows me to be almost stash-free.

@pmakholm this entire thread just reminds me how much I love magit. I used to think I liked git, but I actually only tolerated it. Magit made me love it

@category But then I have to install Emacs...

It might be worth it just to do partial commits of files. I often do "git add -i" and I spend some time thinking about how it works each time.

And I guess that Emacs is liveable with evil mode.

Sign in to participate in the conversation
Mastodon for Tech Folks

mastodon.technology is shutting down by the end of 2022. Please migrate your data immediately. This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!