tag:blogger.com,1999:blog-3669809752172683097.post2462235680189678906..comments2024-02-08T04:04:28.385-08:00Comments on Cyclopedia Square: Best Part of Distributed Version ControlBryanhttp://www.blogger.com/profile/11394436715172971234noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-3669809752172683097.post-20829476180209493182016-03-21T08:43:02.926-07:002016-03-21T08:43:02.926-07:00Jordan, with git you have no choice, you have to h...Jordan, with git you have no choice, you have to have a branch name for each commit path (commit path, I like that description) or else git will hide your commits and garbage collect them, as Display name pointed out. With mercurial that is not needed, but how do you remember which commit path is which? Mercurial (and git) labels each commit with a UUID (sha1 hash). You also are prompted to describe each commit with a commit message each time you create a commit. For me back in my mercurial days that commit message was where I put a reminder to myself. I still do that with git and so a branch name feels redundant.<br /><br />Mercurial also has a helpful command, heads, that shows you the head commit of each commit path. That took the place, for me, of listing branches in git. The process to switch which branch I was working on was: hg heads, read commit messages if needed, hg update . It also helps that hg provides simple numbered commit id's along side the sha1 hashes, so it was a simple hg update 457, not hg update 34ab39e3...Bryanhttps://www.blogger.com/profile/11394436715172971234noreply@blogger.comtag:blogger.com,1999:blog-3669809752172683097.post-12832222750401774952016-03-21T06:16:19.742-07:002016-03-21T06:16:19.742-07:00"If you have some other way of remembering wh..."If you have some other way of remembering which commit path is which, then no, named branches is not going to help."<br /><br />In Git, detached HEADs (or disconnected commit trees, or unnamed "branches"...not sure what the correct term is) will be garbage-collected, i.e. deleted, after two weeks by default. One of the fundamental ideas of Git is that branching is cheap and fast.<br /><br />I think the best practice is, branch first, commit often (in small commits, using hunks staged with Magit), rebase regularly.<br /><br />And if you're using Emacs, be sure to use Magit! It really is like magic!Display namehttps://www.blogger.com/profile/00927446461722414773noreply@blogger.comtag:blogger.com,1999:blog-3669809752172683097.post-20547330391275457152016-03-19T15:48:04.699-07:002016-03-19T15:48:04.699-07:00Ostensibly, the point of branches is to be able to...Ostensibly, the point of branches is to be able to jump back and forth between experiments easily. The point of naming those branches is to make it easier to remember which experiment is which. If you are only working on one thing at a time, then no, branches are not going to help. If you have some other way of remembering which commit path is which, then no, named branches is not going to help.<br /><br />So if you are only working on one thing at a time, the workflow you outline is awesome. What do you do when you need to change gears mid-experiment?Jordannoreply@blogger.com