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

Re: [RFC/PATCH] Add multiple workdir support to branch/checkout

From
JLJulián Landerreche <maniqui@gmail.com>
Date
Oct 8, 2011, 22:55 UTC
Message-ID
<loom.20111009T000812-294@post.gmane.org>
In-Reply-To
<1317786204-57335-1-git-send-email-jaysoffian@gmail.com>
Jay wrote:
> I guess it depends what you mostly use your workdirs for. For me, it's 
> to have different branches checked out, not to have the same branch
> checked out in multiple locations. 

I find those both use cases for workdirs to fit perfectly in my usual workflow (web development).

- Different branches checked out
I've a cloned repo of a CMS and I use git-new-workdir to checkout different 
branches and tags, so to have available a few workdirs of recent versions, which 
I "attach" by symlinks to my web development projects.
- Same branch checked out in multiple locations
This use case just came up recently, when I find out that I prefer to have two 
websites "attached" (via symlink) to two different workdirs of the same branch.
I could have "attached" both websites to the same workdir, but my idea of having 
the websites "attached" to different workdirs was to be able to do some 
development (i.e: to commit stuff) on one workdir, while keeping the other one 
"fixed" at some particular commit. 
Juno wrote:
Show 5 quoted lines
> Careful. Git has survived without your patch series till now, as people
> learned to be careful when they use separate workdirs and avoid certain
> things, to the point that they are not necessarily aware that they are
> avoiding them (one good practice is to keep the HEADs of non-primary
> workdirs detached).
Jay wrote:
Show 5 quoted lines
> Also, while I might recommend new-workdir to my coworkers with the
> advice "don't checkout the same branch in multiple workdirs", never in
> a million years would I say "use new-workdir, but make sure to only
> use a detached HEAD in the workdirs." The latter would make their
> actual HEADs explode. 

After reading this, I noticed that using git-new-workdir with detached HEAD in each workdir could fit my workflow very well. In some cases (the ones mentioned above), I find that I may not need to have a workdir for a branch (where I won't do work, so won't be committing there), but rather to have that workdir "fixed" at a particular commit. That being said, I also see that I would find useful to be able to update/advance this workdir (in a detached HEAD state, that is, "fixed" at an specific commit) to a newer commit or to a particular branch.

Bottom line: making git-new-workdir a more reliable & friendly tool that could fit in the workflows of both advanced and non-advanced users.

----- Quick note about me: I am an "advanced n00b" on git usage (using it since one year ago), and a general non-advanced user (of git and git-new-workdir). In other words, a git user that could easily shoot itself in the foot.

Arrived here while looking for some info about git-new-workdir, and if it was a Bad Idea to have different workdirs of the same branch (ie. checkout the same branch on different folders), as the idea of recklessly committing on different workdirs for the same branch sounded like a recipe for disasters to me.

I find it git-new-workdir a really useful tool in my workflow, and prefer it over having many clones of the same repo, which will imply having to do configuration for remotes and push/pull operations, which are also mind-boggling tasks for non-advanced users. -----

Thanks for reading.
Previous: Jay Soffian
Message 35 of 35 in “Add multiple workdir support to branch/checkout”
  1. Add multiple workdir support to branch/checkoutJay Soffian, Oct 5, 2011
  2. Jay SoffianOct 5, 2011
  3. Nguyen Thai Ngoc DuyOct 5, 2011
  4. Jay SoffianOct 5, 2011
  5. Junio C HamanoOct 5, 2011
  6. Jay SoffianOct 5, 2011
  7. Junio C HamanoOct 5, 2011
  8. Jay SoffianOct 5, 2011
  9. Andreas KreyOct 5, 2011
  10. Jay SoffianOct 5, 2011
  11. Jonathan NiederOct 5, 2011
  12. Jay SoffianOct 5, 2011
  13. Jonathan NiederOct 5, 2011
  14. Junio C HamanoOct 5, 2011
  15. Jay SoffianOct 5, 2011
  16. Jay SoffianOct 5, 2011
  17. Nguyen Thai Ngoc DuyOct 5, 2011
  18. Junio C HamanoOct 5, 2011
  19. Nguyen Thai Ngoc DuyOct 5, 2011
  20. Junio C HamanoOct 5, 2011
  21. Jay SoffianOct 6, 2011
  22. Junio C HamanoOct 6, 2011
  23. Jay SoffianOct 6, 2011
  24. Junio C HamanoOct 6, 2011
  25. Jay SoffianOct 6, 2011
  26. Junio C HamanoOct 6, 2011
  27. Jay SoffianOct 6, 2011
  28. Nguyen Thai Ngoc DuyOct 6, 2011
  29. Bernhard R. LinkOct 6, 2011
  30. Jeff KingOct 6, 2011
  31. Nguyen Thai Ngoc DuyOct 5, 2011
  32. Junio C HamanoOct 5, 2011
  33. Jay SoffianOct 5, 2011
  34. Jay SoffianOct 5, 2011
  35. Julián LanderrecheOct 8, 2011

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.