I'm working on a project where requirements are rapidly changing, therefore some functionality is built then rapidly replaced by other functionality. I'd like to remove some functionality from the project to keep it tidy, but also be able to find it reasonably fast at a later date.

My project folder structure is like this: (Symfony 3)

/projects   <-- I'm already collecting client documents based on change projects here

For example, for one change I want to remove a class (=file) from /Command and /Processor each, but I want to be able to find them and also have some simple documentation what their purpose was.

I have considered the following options:

  1. Simply search git history: I think this will be too tedious and impractical

  2. Use branches before the change: My main concern is that this makes it harder to work with branches for features, as the archive branches will clutter the list

  3. Use git tags: This seems the most sensible to me. Both branches and tags need some way to hold documentation, so I'm thinking of creating documentation at the time of removal either in a /projects folder or in some central file

  4. Copy the removed source code to a folder: This seems impractical, because sometimes I may only remove some functions

  5. Copy the whole source code before removal to a folder: It seems hard to find out afterwards what exactly changed

Are there any other solutions I'm not considering?

  • If the customer doesn't want those features today, why would they want them later? Or why would you keep around code that has been superseded by other code? We often keep things around "just in case," but in reality, that case usually doesn't happen. See also YAGNI. – Pedro Jan 10 '17 at 19:58
  • The idea is half compliance, half re-use for another customer – jdog Jan 10 '17 at 20:41
  • 2
    Forget about it. Things change. What you wrote and discarded for one customer is not going to suit another anyway, even if it sounds similar. – Marjan Venema Jan 11 '17 at 8:07
  • 6
    Use git-log -S or git-log -G, move snippets to gists, or just accept YAGNI. It's very rare that a piece of dead code is actually useful later in a cut-and-paste sort of way. If you can't find things in your logs, you need to improve your commit messages and the granularity of your commits. :) – CodeGnome Jan 20 '17 at 5:49
  • Thanks @CodeGnome, maybe with some article links or key techniques this could be the accepted answer – jdog Jan 25 '17 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.