git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: cogito/git usage question

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 29, 2005, 18:31 UTC
Message-ID
<Pine.LNX.4.58.0508291106510.3243@g5.osdl.org>
In-Reply-To
<4313369B.5060508@eircom.net>
On Mon, 29 Aug 2005, Bryan O'Donoghue wrote:
> 
> If I'm understanding, I update to a given git repository, branch locally
> based on tags and then I can checkout a branch locally, to make that the
> active branch.

Exactly. This is the difference between a tag and a branch: a tag is an "immobile" point in time, while branches are "heads of active development" (there's a bit more detail to this: you _can_ change a tag, so it's not like it's totally fixed in stone, but the point is that it's not a dynamic entity - it's some fairly static thing that you've protected).

So you can't start new development off a tag directly: you need to create a new branch that just starts off at the point that the tag points to. So if you really think of a branch as that "head of active development" and tags as "static points in time" this all makes tons of sense.

Btw, you don't need to branch based on tags: you can branch based of _any_ kind of local reference. A tag is just a common one. But you can branch based on your current state too, ie a command line like

	git branch -b fixup HEAD^

means that you will create a "fixup" branch that starts not at a tag, but at the "parent of HEAD". In particular, let's say that you just committed something, and realized that you need to work on something else without the new thing disturbing you (you have a patch that applies in the same area, or whatever), something like the above works fine.

Or just use "gitk" to visually find a place, and when you decide to start a new branch somewhere, select that commit in gitk, and use the cut-and-paste facility to just paste the SHA1 directly into

	git branch -b working <any-random-point-sha1>

so it's not like the tags are important per se, they're just short-hand symbolc way-markers.

			Linus
Previous: Bryan O'Donoghue
Message 4 of 4 in “cogito/git usage question”
  1. Bryan O'DonoghueAug 29, 2005
  2. Linus TorvaldsAug 29, 2005
  3. Bryan O'DonoghueAug 29, 2005
  4. Linus TorvaldsAug 29, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.