Annotated Tags Annotated tags are stored as full objects in the Git database. Lightweight tags are essentially 'bookmarks' to a commit, they are just a name and a pointer to a commit, useful for creating quick links to relevant commits. The link you posted uses different naming schemes for tags and branches: if you're already mostly following that method, adopting its naming scheme might be the easiest solution. This is important data for a public release. Unfortunately, it sounds like the easiest way to solve this problem might be to change the way you name your branches. This sounds painful, and it could be undesirable if the shadowed branch is currently checked out. That is, write a wrapper that checks if there are any tags that shadow branch names, and warn about (or delete) those branches. Write a wrapper around "git pull" and "git fetch" This might be hard/awkward depending on the size of your organisation. Train people to delete their local branches when they see a new tag Git checkout prefers branch names: % git checkout v1.5.2īut git log will use the tag name: % git log -decorate -oneline -1 v1.5.2 ![]() other commands will use refs/tags/ over refs/heads/ (see gitrevisions)įor example, in this test repository, the v1.5.2 branch points to commit B, but the v1.5.2 tag points to commit A.git checkout will check out refs/heads/ over refs/tags/ (see git-checkout). ![]() That is, if you're happy with the fact that: If you absolutely want to keep this naming scheme, you might: Decide that you don't care about these warnings Or is it unavoidable, and therefore a fundamentally bad idea to create a tag with the same name as a deleted branch? git branch experiment master create branch called experiment from master pointing to the present commit git checkout experiment switch to branch. All branch names, such as master which is short for refs/heads/master, are constrained to identify only a commit object. This leads to an ambiguous reference, when trying checkout v1.5.2 in those repos: $ git checkout v1.5.2Ĭan this be avoided without using a different syntax for the branches, e.g. More specifically and precisely, a tag name like v2.1 is the short version of the fully-qualified reference name refs/tags/v2.1, and any Git reference identifies some Git object. The git push origin :v1.5.2 command will delete the branch in the remote, but does not delete the local version of the branch (if it exists) in all repos. You can checkout a specific tag using the git checkout command as follows: While on the active branch feature we will checkout tag v3.o.another dev machine, or staging environment) has a local checkout of the v1.5.2 branch. ![]() This seems to work in the majority of cases, however it's causing an issue in the scenario where another instance of the git repo (e.g. $ git tag -a v1.5.2 -m "Version 1.5.2 - foo bar, baz, etc" Here's the commands we'd use to close a release branch: $ git checkout master Once a release branch is given the green light for production, we close the branch, by merging it into master, applying a tag, and then deleting the branch.Īs we immediately delete the release branch, we've been using the same identifier for tagging the branch, e.g. Our release branches are named in a SemVer format, e.g. I have a project with a git branching model that roughly follows that of nvie's git-flow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |