1

I currently have a v1 API and have updated and created new scripts for v2. The API is consumed by other developers and consists of a bunch of scripts. Before migrating and adding v2 I want to make sure I have a successful versioning strategy to go ahead with.

Currently, there is a bash script called before using the API, with which you can supply the version # or by default gives you the most recent version. Originally, I intended to have different subfolders for each different version, but for scripts that do not change between revisions and scripts that get content added to them, the git history will not be preserved correctly as the original file will still reside in the v1 subdir and will not be 'git mv'ed. This is obviously not the best way but I can't think of a better way currently.

Any recommendations will be helpful but one restriction is that we cannot have a git submodule with different branches. There are no other restrictions (e.g. the bash file used for setup can be deleted) as long as the scripts are accessible. Thanks!

EDIT: We also have scripts above the "API" directory that are part of the same repo that call into the API (we are consumers of our own API). The changes to these files need to be visible when using any version of the API and cannot just be seen in the latest version (related to tags in the repo)

1 Answer 1

2

I think you want to use tags in your git repository. For each version of your api, use git tag vn and you don't need to maintain earlier versions of your files. You can access all files at a certain version just using git checkout vn.

If you use a remote repository, you need to use the flag --tags to send the tags to the remote repository, ie, git push --tags.

Sign up to request clarification or add additional context in comments.

6 Comments

One thing I forgot to mention (I'll add it) is there are other scripts that live above the API subdirectory (that actually call into the API) and if we tag a specific version of the API these scripts will not have the latest updates.
Why do you need to maintain old versions of your api? You can't maintain only the last version and if you need to come back to a earlier version, use git to get a earlier version of a file?
Because we have to support them for other people that consumed that version. There are not enough resources (or a reason really) to force all consumers to update to v2.
In this project, you will only use v2 or both?
I will only use the latest but must maintain support for all previous versions.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.