Skip to content

Add and view Git tags #4829

Closed
Closed

Description

@renegadedata

Update from GitHub Desktop team:

We're working on this! Initial support for this will include creating, pushing, and viewing tags in Desktop. After reading all the comments in this issue and talking with several people who feel like they're missing this, editing and deleting tags seemed fraught and had potential for unexpected things to happen between your local repo and the remote.


Is your feature request related to a problem? Please describe.
No

Describe the solution you'd like
It would be awesome to have the ability to tag commits (e.g., the equivalent to the command-line git tag <tagname>), including the ability to move, delete, edit and push up tags to remote repository.

Describe alternatives you've considered
Just the command-line.

Teachability, Documentation, Adoption, Migration Strategy
Our team uses tags consistently for build and version numbers to keep deployments consistent and more easily trackable.

Activity

  1. crea7or commented on Jun 14, 2018

    @crea7or
    Contributor

    @shiftkey is there any backend to fetch/store tags in desktop code? I really like to see the tags too and I'm deciding how hard it for me to implement it.

  2. shiftkey commented on Jun 15, 2018

    @shiftkey
    Member

    @crea7or before diving into the code I'd recommend starting from proposing how the user would interact with tags in the app, to illustrate the potential workflows and help size up the work.

    An example of this is a mockup in an earlier thread about this: #257 (comment)

    We could do something similar to dotcom and separate out branches and tags using something like a segmented control:

    image

    Going beyond "Git has feature XYZ" and walking through how a feature would look or feel in Desktop is where I'd recommend starting with this - this will help get others behind a potential solution to the problem at hand.

  3. crea7or commented on Jun 15, 2018

    @crea7or
    Contributor

    Why not in commit panel? There is a free space available right after the authors and commit date. Tags in separate list will be less useful. Tags can be created from the conext menu right here.
    image

  4. renegadedata commented on Jun 15, 2018

    @renegadedata
    Author
  5. jeffreydking commented on Jul 10, 2018

    @jeffreydking

    I agree with @renegadedata, tags should be implemented in two contexts.

    First, on the "Changes" tab, just above the Commit button, add some user input to add a commit tag and a pre-release checkbox that appears when the tag input is non-empty.

    Second, on the "History" tab, tags would be added as badges next to the commit name. On this tab, if you right-click on a commit, there would be an option to "edit tag" if there was already a tag, or "add tag" if there was not. These would bring up appropriate modals to accomplish the tag edit/add tasks.

  6. j-f1 commented on Jul 10, 2018

    @j-f1
    Contributor

    Perhaps we could have a “🏷➕” button, next to the “Add Co-Authors” button.

  7. shiftkey commented on Jul 12, 2018

    @shiftkey
    Member

    Thanks for the ideas, y'all. I'll add some of my thoughts to this from the backend side.

    Displaying Tags

    Why not in commit panel? There is a free space available right after the authors and commit date.

    @crea7or @kingjeffrey I had a look at the docs to see if we can get this information from git log (which is the source of these commits). We use --pretty and these placeholders:

    const prettyFormat = [
    '%H', // SHA
    '%s', // summary
    '%b', // body
    // author identity string, matching format of GIT_AUTHOR_IDENT.
    // author name <author email> <author date>
    // author date format dependent on --date arg, should be raw
    '%an <%ae> %ad',
    '%cn <%ce> %cd',
    '%P', // parent SHAs,
    '%(trailers:unfold,only)',
    ].join(`%x${delimiter}`)

    %d or %D is the placeholder to add the refs associated with this commit, and each entry looks like this:

    $ git log --decorate=short --pretty='%H %s %b %d' -n 2500 | grep 'tag:'
    57fe4f59955c74359a40fbe3d1bf02ea77f3a69c Merge pull request #5130 from desktop/cut-a-new-beta time for a fresh beta  (HEAD -> master, tag: release-1.3.0-beta1, shiftkey/master, origin/master, origin/HEAD, github-desktop-agisilaos/master)
    61d9aea2c1f19af9e3f9f1fd4d17f3f2495f5e09 bump for next beta   (tag: release-1.2.7-beta0)
    908a2695640cbc6d00cad303d5c0c2d2eb864245 actually this is the right PR number   (tag: release-1.2.6)
    0a1e96794fb9c8e87e3b501b5fdb85e372f5ee90 bump beta channel too   (tag: release-1.2.6-beta0)
    02240059e44c1d856a930a51c7b6621bff327768 changelog for hotfix release   (tag: release-1.2.5)
    

    I think if we can figure how how to extract these from the log output:

    const commits = lines.map(line => {
    const pieces = line.split(delimiterString)
    const sha = pieces[0]
    const summary = pieces[1]
    const body = pieces[2]
    const authorIdentity = pieces[3]
    const committerIdentity = pieces[4]
    const shaList = pieces[5]

    And attach these to the Commit model:

    export class Commit {

    We can then figure out whether the commit list makes sense or the commit detail form, like GitHub The Website does (we like to be consistent across products wherever this makes sense):

    Managing Tags

    I think it would be helpful to have it as an option in the commit panel, right below summary, and, more importantly, to be able to go to the History tab, right click a commit, and have two options: Add Tag and Remove Tag.

    @renegadedata I haven't really thought much about adding and particularly removing tags in terms of the workflow, but I have some initial reservations around letting users delete tags which exist on a remote.

    For reference, we prompt the user when they delete a local branch that is tracking a remote branch to confirm the action. But tags feel more permanent, so we should be cautious about this side of things.

    The push to remote should replicate the tag information including moves, deletes, and changes.

    I don't think we do any of this currently, and I think we could investigate the tradeoffs for adding --follow-tags to a git push so that we also push local tags that were created on the branch you are currently pushing - this seems like a responsible thing to do.

    The code for that is in here - are you interested in submitting a fix for that so we can talk about this scenario further?

    export async function push(
    repository: Repository,
    account: IGitAccount | null,
    remote: string,
    localBranch: string,
    remoteBranch: string | null,
    progressCallback?: (progress: IPushProgress) => void
    ): Promise<void> {

  8. added
    user-research
    and removed on Jul 12, 2018
  9. shiftkey commented on Jul 12, 2018

    @shiftkey
    Member

    I'm moving this to a user-research task because there's lots of ideas around the interactions that we need to think about some more.

  10. crea7or commented on Jul 12, 2018

    @crea7or
    Contributor

    Can we start with displaying tags in history?

  11. shiftkey commented on Jul 12, 2018

    @shiftkey
    Member

    @crea7or we can't display things we don't have the data for, which i why i wrote up how to get that as a pre-requisite. But if someone wants to build upon that and get something working in the app then then sure, why not?

  12. jeffreydking commented on Jul 12, 2018

    @jeffreydking

    @shiftkey In the logs used to populate history, I see tag information. I assume "pre-release" status is not exposed in the logs. If so, I assume that information is not available to the history tab. Is this correct?

  13. shiftkey commented on Jul 12, 2018

    @shiftkey
    Member

    @kingjeffrey I'm not sure what "pre-release status" refers to here, but the snippet above shows how we can get these from the logs when using the pretty formatting:

    $ git log --pretty='%H %s %b %d' -n 2500 | grep 'tag:'
    57fe4f59955c74359a40fbe3d1bf02ea77f3a69c Merge pull request #5130 from desktop/cut-a-new-beta time for a fresh beta  (HEAD -> master, tag: release-1.3.0-beta1, shiftkey/master, origin/master, origin/HEAD, github-desktop-agisilaos/master)
    61d9aea2c1f19af9e3f9f1fd4d17f3f2495f5e09 bump for next beta   (tag: release-1.2.7-beta0)
    908a2695640cbc6d00cad303d5c0c2d2eb864245 actually this is the right PR number   (tag: release-1.2.6)
    0a1e96794fb9c8e87e3b501b5fdb85e372f5ee90 bump beta channel too   (tag: release-1.2.6-beta0)
    02240059e44c1d856a930a51c7b6621bff327768 changelog for hotfix release   (tag: release-1.2.5)
    
  14. 51 remaining items

  15. slspencer commented on Apr 1, 2020

    @slspencer

    Start with lightweight tags! There will always be users who urge you to 'do it all', but it's ALWAYS best to implement the minimum feature set first.

  16. billygriffin commented on Apr 1, 2020

    @billygriffin
    Contributor

    Follow up question based on your responses. It seems like we can create annotated tags with just the tag name and everything else empty, which would allow us to treat them just like lightweight tags from the user's perspective, but retain flexibility for potentially offering more functionality down the road. This would also allow us to constrain the tags we push to only annotated tags so people aren't inadvertently pushing a bunch of old lightweight tags to GitHub.

    For those of you who suggested lightweight tags, if we were to use annotated tags with just the tag name instead, would that cause any problems for you?

  17. slspencer commented on Apr 1, 2020

    @slspencer

    +1 Annotated tags with just the tag name

  18. billygriffin commented on May 7, 2020

    @billygriffin
    Contributor

    Hi folks, this is all now live on beta so I'm going to close this issue. 🎉 We expect the production release to happen next week! If you want to start using it immediately, you can download the beta here: https://github.com/desktop/desktop/#beta-channel

    Thank you all SO much for all the input along the way - it has been immensely helpful. ❤️ ✨

  19. billygriffin commented on May 12, 2020

    @billygriffin
    Contributor
  20. sraillard commented on May 12, 2020

    @sraillard

    This is a very good news!
    We can see tags on commits and add them, but is there way to delete a tag?
    Do you plan to add an option to list all the tags of the repository, so we can find a commit from a tag?

  21. adipose commented on Jun 8, 2020

    @adipose

    Still cannot select existing tags like we can on github.com?

  22. mikermcneil commented on Nov 19, 2020

    @mikermcneil

    This is tangential somewhat, but related to tags, and since GitHub+NPM is a thing now, figured I'd mention it in case any other package maintainers have run into this:

    I would love a "Tag & publish" button, for NPM packages -- i.e. a GUI equivalent to npm version && git push && git push --tags && npm publish

    e.g. a dropdown with options equivalent to:

    • npm version patch
    • npm version minor
    • npm version major
    • npm version

    To recap: npm version does (1) update package.json, (2) commit, (3) tag

    (P.S. at some point, support for NPM dist tags would be a nice bonus, e.g. for doing edge-tagged prerelease distributions)

  23. MiguelRipoll23 commented on May 23, 2021

    @MiguelRipoll23

    @mikermcneil found something for that, check this out.

  24. 9503261188 commented on May 23, 2021

    @9503261188
  25. 9503261188 commented on May 23, 2021

    @9503261188
  26. Naminave commented on Mar 25, 2022

    @Naminave

    so many comments and none gives a solution to what was proposed by OP, to be able to change between tags?

    image
    image

    image
    image

  27. OverLordGoldDragon commented on Aug 5, 2023

    @OverLordGoldDragon

    @ImanCol Another meaning of "tags" is invoked in OP. I agree the one you mention is useful, and opened #17185.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions