DEV Community

Discussion on: Git quick tips #2: Working with many branches

Collapse
matthewpersico profile image
Matthew O. Persico

Disk is cheap. I put every new branch in its own same-named worktree. Switching tasks is as easy as a 'cd' command. No stashing, no worrying about what branch am I on because its in my pwd which is in my prompt.

Collapse
citizen428 profile image
Michael Kohl Author

That sounds like a flashback to SVN branches. 🙂 But why not, if it works for you it's a good system.

Collapse
matthewpersico profile image
Matthew O. Persico

It’s very highly scripted. I keep all gits in $HOME/ gits/ “remote server”/org/repo. Each worktree in a subdir of that called wt. I can run a command git go to give me a listing and then I pick one to cd to. I even wrote my own ‘git’ dispatcher function so I could enhance existing commands. I should write an article about that

Thread Thread
citizen428 profile image
Michael Kohl Author

I for one would love to read it! IMO one of Git's best features is what you can build on top of it in terms of highly individualized workflows, it's almost like a VCS construction kit.