Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I program simple tasks everyday, but I have a hard time finding the scripts, and code snippets I write. Is there an manageable way to keep track of this sort of thing?

share|improve this question

closed as not a real question by gnat, Walter, Yusubov, Robert Harvey, Dynamic Dec 11 '12 at 22:53

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3 has a gist function, which acts as a code snippet library – Luceos Dec 11 '12 at 10:39
How do you handle scripts and code snippets for now? What kind is it, bash or powershell scripts, etc.? – Spoike Dec 11 '12 at 11:51

I use Mercurial for this. My work is on both Linux and Windows, so I have such small code snippets for both the system. I have created a repository on windows, on which I save all this scripts and then the clone of this on linux. I keep both in sync.
Other than the use of DVCS, I also have a single csv text file which works as a key, value pair. The key is a small description of a program and value is it's location on the repository. Whatever I need I search in this file, and also keeps this file up-to-date. No need to tell that this file is also part of the repository.
Let me warn you that, It has taken lots of efforts and discipline to make a habit of keeping things clean and neat.
For Git lovers, I also love Git and also have repository in Github. It just that Mercurial is our official DVCS.

share|improve this answer
+1 for pointing out that a VCS alone is not enough. – Doc Brown Dec 11 '12 at 11:39

Try bookmarking your code with reminder comments. That will help you a lot. Also there are a variety of great source control management systems available in the market.

share|improve this answer

As others have already said, a VCS alone is not enough for this. What your really need is a "database" of (possibly versioned) snippets or, even better, a "knowledge base" or a "wiki" of snippets like github's gist.

If you are in my same position, most likely you are not allowed to publish your code. In this case, you have to setup your own gist, either on your PC or on a server on your LAN.

Have a look at gitpaste for this:

There are other gist clones that can be used for this task, out there. You can also use one of those "desktop wiki" (or "mind mapping") programs that were so fashionable some years ago.

Everything that can help you to create a small, managed (and possibly versioned) "snippet base" will work fine.

Of course, if you are allowed to publish your snippets, you can just use gist.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.