I work from multiple locations quite frequently, and there’s times (16:59 on a Friday for example) when I need to leave quickly with potentially unstable code. Right now I tend to commit and push the days work to my branch and work on it from home/elsewhere, but this feels a little dirty. Would others consider this acceptable? How else would you go about it?
1
There are two main reasons to use branches in a VCS:
- To isolate unreleased features from each other and from released code. This is mainly what git flow is all about.
- To share unfinished code with other developers without impacting the whole team. This is exactly your use-case, where you can read “other developers” as “myself sitting behind different computers”.
So, yes, committing non-compiling, unfinished code to a branch is perfectly fine. The only consideration should be that others (including automated build setups) don’t depend on that branch being stable/buildable.
This is perfectly acceptible for me. In fact I’ve probably done this since I started using version control as I found it the most convenient way.. Other options like dropbox etc work but then you still have to wait for the sync and it does lead to conflicts sometimes which are a mess. I’ve even known people emailing themselves the temporary work, even messier.
I usually don’t just push to the branch I’m working on though, but to a branch called work-in-progress for example: if you’re in a hurry it’s easy to just push all current changes to a branch as-is without having to properly lay out one or more commits with decent messages etc or without having to fix your messy commit afterwards.