Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I version control (sort of) unrelated scripts in the same path?

I've started using version control to better manage revisions to my PowerShell code. I decided to use Mercurial for 3 main reasons:

  1. As a DVCS, it doesn't require a server.
  2. If I want to, I can store a private repository online for free (bitbucket.org)
  3. It seemed simpler to use than Git.

Mercurial works well for versioning PowerShell Modules since each module is contained in its own directory. However, I have some scripts that don't belong in a module, but I would still like to version them. These scripts are in a ".\Scripts" directory that is added to $env:PATH so I can easily run them from the command line. Since these scripts aren't really related to each other, it doesn't make much sense to create a single repository for the Scripts directory.

How should I version single scripts?

I've thought of the following options:

  • Create subdirectory for each script/related scripts.
  • Use temporary repositories until the script is "stable" then add the script to the main "Scripts" directory and version the collection of scripts as one. This would reduce the number of changesets introduced to the "Scripts" repository.

Is there a tool that better handles versioning single files? Is there better way for versioning single files with Mercurial? Any other ideas?

like image 842
Rynant Avatar asked Aug 15 '11 20:08

Rynant


People also ask

What should be version controlled?

Version control should be used where more than one version of a document exists, or where this is likely to be the case in the future. finalised version is complete. This would be titled version 1.0. If version 1.0 is to be revised, drafts would be numbered as 1.1, 1.2, etc.

How version control is applied in the management of shared content?

Version control enables multiple people to simultaneously work on a single project. Each person edits his or her own copy of the files and chooses when to share those changes with the rest of the team. Thus, temporary or partial edits by one person do not interfere with another person's work.

Which of the following types of version control system has a single repository for a project?

Centralized Version Control Systems: Centralized version control systems contain just one repository globally and every user need to commit for reflecting one's changes in the repository.


1 Answers

Grouping of files based on their functionality should be based on

1) Name.

2) Folder they are in.

Just give a proper name for the scripts. If there are multiple related scripts group them into a folder. Having one script per folder makes no sense. You end up with almost same number of folders as scripts.

All this in a single repository. Generally, people have multiple projects in a single repo. Creating multiple repos, especially for a few files means lots of overhead. If the script is not "stable" use branches. That is what they are for and merge them back.

And don't worry how many "changesets" are there in the repo!

PS: Might seem a bit opinionated, but there is no real right or wrong answer for what you ask.

like image 148
manojlds Avatar answered Oct 06 '22 23:10

manojlds