6 ms·
It really isn't. It takes almost no effort to `git checkout -b feature-branch` before an add and commit.
by yock 13y ago
It really isn't. It takes almost no effort to `git checkout -b feature-branch` before an add and commit.
- gbog 13y agoExcept that you need to know what you will do in advance, in order to give a meaningful name to the branch, and you need to delete odds branches in order to find your way when switching, et cetera. The first point is stronger than it seems, at least for me. It is a bit like requiring a definitive title to a novel I'm starting to write before the first line is there.
- jstclair 13y agoTo rename: git branch -m old-name new-name Candidate branches for deletion: git branch --merged
- Crito 13y agoBranches are literally just text files that contain a sha in refs/heads. The name of the file is the name of your branch. They are an incredibly lightweight concept that should never be considered the source of any sort of technical debt.
- Cthulhu_ 13y agoLuckily with Git, you have infinite power with that kinda thing - at least until you push and share your code. Branching is cheap; moving commits from one branch to another is easy; creating a branch after you've done a couple commits is simple. The difficult part, I think, is on the one side realizing what power you have and how to use it, and on the other side plain discipline.
- aqme28 13y agoI think that knowing what you want to do before you try to do it is a good engineering practice in its own right.
- gbog 13y agoNot sure. Do you think Da Vinci sat at his table and thought "let's invent the helicopter" (with a nice unique memorable name for his work in progress)? I would rather imagine Da Vinci being supposed to draw some boring architectural work or even writing against his will to his great-grant aunt. And then a paper fell off his table, spinning away. And then I imagine Da Vinci drawing a spinning paper on the margins, and adding equations, schemas, and getting deeply inside this new project, which becomes clearer in his mind as he works on it, without ever having a name. This is exactly why I hate deciding a branch name before some tasks and I love `git add -p` which allow me to add a bucnh of unrelated things in the work tree and extract the juice later.
- yock 13y agoWith git you can experiment to your hearts content. Then, once you decide you have something ready to go, create the branch and commit to it. You don't have to create the branch first.
- dllthomas 13y agoOr even create some branches called "experiment1", "experiment2", &c, until you figure out what it should be called.
- yock 13y agoHere, $10 well spent. Watch and be enlightened. http://pragprog.com/screencasts/v-jwsceasy/source-control-made-easy http://pragprog.com/screencasts/v-jwsceasy/source-control-ma...
- Aloisius 13y agoThen use git stash?