3

I work on a lot of ColdFusion projects that are housed on a single web server. I've recently been 'shown the light' by others on SO and want to move to a developer machine / test machine / production machine development methodology.

I'm now trying to reconcile how best to deal with the way I (and others in our institution) are 'forced' to work...

Let's say our webserver is set up like this

-Root
--Project 1
--Project 2
--Project 3
--Framework Files

Let's also say that we have a central git repository set up and that I have a clone of the root that I'm working with. All other developers in the group also have their own clone of the repository.

So -- It's Monday morning and I've started work on Project 1. I'm in the middle of an estimated 4 hour feature request and one of my eight different bosses comes in and tells me that there is a critical problem that needs to be fixed in Project 2. Monday is off to a great start.

I need to fix Project 2 STAT, but I'm not done with the feature request for Project 1 yet. If I fix in Project 2, then commit to my local repository to push to test... it's going to include the unfinished feature in P1... which is bad.

If I extrapolate from Joel Spolsky's Mercurial Init Architecture page, is the solution to create a 'dev' clone of the repository for each subproject? To commit to those, then commit to main local repository, then to the main shared repository?

Is there another concept in Git that I'm missing?

Thanks all, Chris

Community
  • 1
  • 1
Chris Brandt
  • 948
  • 3
  • 11
  • 22

2 Answers2

8

I would suggest looking at branching.

By branching, you can maintain multiple different streams of development at once, and swap between them trivially. Furthermore, you can create remote branches in a remote repository and multiple team members can work on these simultaneously. They can be as long-lived or short-lived as you want, and Git excels at creating and maintaining many, many branches.

It's distinct from stashing since stashing is a stack-based mechanism for storing work to come back to later. It's not distributed and to manage multiple workflows via a stack would be difficult, to say the least.

Here's a useful page discussing branching workflows.

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
5

You're missing the stash feature, which lets you "put away" unfinished work and come back to it later. This feature allows you to take a "dirty" directory - where you've modified files since the last commit, but aren't quite ready for a commit - and save the changes without making a commit. The directory will be returned to the way it looked at the last commit, with your changes saved by git. The usage is pretty simple... from the link above, you can save your work using the save:

$ git stash save "work in progress for foo feature"

and you can restore your work again using apply:

$ git stash apply

Another problem is that you have all your projects in a single repo. While this isn't best practice, it can be addressed using submodules, which essentially lets you have multiple repositories within a single overarching repository. The above link is an excellent resource on how to use submodules, and there are a number of useful posts here on SO discussing how to use them.

Community
  • 1
  • 1
eykanal
  • 26,437
  • 19
  • 82
  • 113