version control - How to use Git to tag a commit rather than a hash -
i have large series of commits, various version tags, i.e.:
root->x->x->1->x->x->x->2->x->x->3->x->4->x->x->x->5->master
i want insert new commit near start of this. problem is, need go through , re-tag everything, because tree ends looking this:
root->x->x->y->x->x->x->x->x->x->x->x->x->x->x->x->x->x->master \->1->x->x->x->2->x->x->3->x->4->x->x->x->5
is there way can tag specific commit, rather specific hash? when rebase, tags apply same specific commits, in new tree, rather original commits?
note: not interested in moralizing - please don't post answers saying things "you're doing wrong" or "that's not how versioning supposed work" unless can provide constructive alternative. need way mark commits persist after rebase, if possible solution "git doesn't that, use x instead".
here alternative solution i've seen many repositories use.
- create branch every major version want maintain.
- push fixes/updates every branches. use merging/rebasing/cherry-picking between them when possible avoid repetitive work.
- tag commits in branches minor/patch versions.
example:
- you have
master
branch. - you release version
1.0.0
pointing currentmaster
. - you continue push
master
, release1.1.0
version. - you make major refactor/backwards incompatible changes , release
2.0.0
version. - you could (and should) make
1.x
branch pointing previous1.1.0
version. - you push bug fix (in
master
) affects both2.x
,1.x
versions. - tag commit
2.0.1
. cherry-pick in1.x
branch , tag1.1.1
.
there variations workflow. have branch major versions , master
branch active development branch next major version.
i think solving problem going deeper , addressing root cause of workflow - pushing change several versions.
i should mention changing tags point after you've pushed tags bad. bad.
Comments
Post a Comment