Skip to content

Conversation

@fregante
Copy link
Member

@fregante fregante commented Feb 23, 2018

Closes #1029

Icon

Edit: check out the comment below #1115 (comment)

I couldn't find a relevant icon for default or HEAD, so I'm using the merge icon as upstream. Can you suggest a better one from here? https://octicons.github.com/

demo

Test

The default branch is detected thanks to this information that only appears in folder views on branches.

branchinfo

No icon

https://github.com/sindresorhus/refined-github (already default branch)
https://github.com/sindresorhus/refined-github/tree/master (already default branch)
https://github.com/sindresorhus/refined-github/blob/webpack-4/license (files aren't supported)
https://github.com/sindresorhus/refined-github/tree/1.20.1 (tags aren't supported)

With icon

https://github.com/sindresorhus/refined-github/tree/webpack-4 (branch root)
https://github.com/sindresorhus/refined-github/tree/webpack-4/media (branch folder)

@hkdobrev
Copy link
Contributor

Probably the house icon as in go back to home, the default view.

@fregante
Copy link
Member Author

I thought about that but “home” feels like the root, but it could just be a sub folder of a different branch, still not “home”

@hkdobrev
Copy link
Contributor

Well, yeah, but at the same, there are two big problems with the current icon:

It does not represent upstream. This is the icon for merging from the GitHub Flow (it's on my T-shirt 😂).
Even if there was an icon for upstream, it doesn't relate to changing the branch.

An alternative icon would be the commit icon as it's closest to "branch".

I would actually suggest just putting HEAD there instead of an icon.

@fregante
Copy link
Member Author

fregante commented Feb 24, 2018

I would actually suggest just putting HEAD there instead of an icon.

I think HEAD is actually just whatever you're looking at now, you're always on HEAD

An alternative icon would be the commit icon as it's closest to "branch".

Yeah that wouldn't be bad. An alternative perhaps would be a left or up arrow, kinda like "go back to main".

@fregante
Copy link
Member Author

fregante commented Feb 25, 2018

back

How about a simple back chevron?

@hkdobrev
Copy link
Contributor

When looking at the upstream repository refs/remotes/origin/HEAD would be the main branch, not the upstream branch of your currently checked out branch locally.


👍 for the chevron as well. However, it would move the branch selector from its default position when present if it's on the left side.

@fregante
Copy link
Member Author

it would move the branch selector from its default position when present if it's on the left side.

True, but I think it's not a big deal since the branch selector is very wide and the movement is of about 30px. What do you say? I think it's less nice on the right side pointing back to the current branch.

I'll guess that we will always have the link to the default branch in the selector.
@fregante fregante force-pushed the link-to-default-branch branch from 226dfbd to d6e971c Compare February 25, 2018 18:17
@fregante fregante force-pushed the link-to-default-branch branch from b2e8b91 to 4bc8bdb Compare February 26, 2018 20:38
@fregante
Copy link
Member Author

Temporary caching in 4bc8bdb enables it on files as well :)

files

Copy link
Member

@sindresorhus sindresorhus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really useful and seems to work perfectly. 🎉

Needs to be added to the readme.

@fregante
Copy link
Member Author

fregante commented Mar 5, 2018

screen shot for readme

@fregante fregante merged commit 2126a2b into master Mar 5, 2018
@fregante fregante deleted the link-to-default-branch branch March 5, 2018 07:24
@niklashigi
Copy link
Contributor

niklashigi commented Mar 9, 2018

When I'm on a forked repository and hover over the button a tooltip suggesting that it would link to the origin's respective branch appears. However, the link doesn't lead there. It leads to the branch on the current repository (often the same page).

Example from my refined-github fork, I expect the button to link to /sindresorhus/refined-github:

<a
  class="btn btn-sm tooltipped tooltipped-ne BtnGroup-item"
  href="/shroudedcode/refined-github"
  aria-label="Visit the default branch (sindresorhus:master)"
> ... </a>

That's confusing and not what's supposed to happen, right?

@fregante
Copy link
Member Author

fregante commented Mar 9, 2018

It’s-a-bug and I got you pal #1132

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

Development

Successfully merging this pull request may close these issues.

4 participants