Say for example I have some unused code that I want to use in the future and does not work with the rest program,or say that I come across some interesting code online. Is there any good program that I can store different pieces of code in?

  • Emacs org-mode might be a interesting choice for taking notes and storing programs. It's powerful and especially suited to programmers.
    – xji
    Commented Apr 25, 2017 at 11:35

4 Answers 4


If it's for a program which is already under source control, just keep these changes in a branch of that repo.

For odd bits of code, you could use almost anything, but some good options would be private GitHub or Bitbucket repo, a Gist, or some private source-control system you maintain on your own hardware. Non-source control options might include dumping things into an S3 bucket or similar cloud storage system, esp. with your usage likely to not exceed the free pricing tier.


To my mind - these are 2 different questions:

Unused code that I want to use in the future and does not work with the rest of the program

If your VCS system supports it, I'd be inclined to put this in a shelveset since it isn't current development but you may want to pull the code and work on it later.

Some interesting code online

Rather than pollute the source code tree with this, either bookmark the page or stash the code somewhere else (print it off, put it on the LAN, store it on a USB stick etc).

You may also want to email it to colleagues or add it to a wiki to raise awareness.


I think a good way to park your code is git. For example if you have a github account just create a repository there and put all your samples there.

I have something similar in my account and I call it garbage

It might be better than S3 or gists as you can organize/version/search your parked code easier.

  • Gists are versioned (they're git repositories). They're also searchable if public.
    – 8bittree
    Commented Apr 28, 2017 at 20:02

If it is part of your project, I would make a branch or a tag and then delete that code from your main repo.

I used to keep blocks of code in my main repo that served no other purpose other than that they might be needed later. Really what I was saying was that it might be useful later and I needed to find it. A tag might be even better as branches are supposed to be more ephemeral. Branch vs Tag

In any case unused code will just confuse you and other devs later. So it's not a great practice to leave it in a project.

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