How to use branches in GitHub for Windows - github

I've just started using "GitHub for Windows", and I can't figure out how to see other branches (or create other branches).
The help page mentions this feature, and even shows a screenshot, but does not detail how to get to it.
I am aware of how to create and checkout branches from the command line, but I would like to do this from within the UI.
Does anyone know how to do this?

Found it! It's actually very easy when you realise where to look. The name of your branch is shown next to the "sync" or "push to github" button. Clicking on this shows all the existing branches, as well as a text box to create a new one:

Related

Disable "hidden conversations" in GitHub pull requests?

When I go to a page of an open PR in GitHub, e.g. https://github.com/xyz/abc/pull/123, when the number of conversations exceeds some limit, GitHub automatically collapses some of them in the middle under a box that says "[n] hidden conversations"; you have to click "Load more" in order to see them.
Since the open conversations are the most important thing on a PR and the reason I open or refresh the page in the first place, is there a way to undo this and always show all the conversations? I haven't seen anything relevant in settings; does a browser extension exist to do this?
I've had the same issues. This isn't a solution, but it might be a workaround. I only just discovered it, so I'll have to see how it feels going forward.
In a GitHub PR, change the tab from "Conversation" to "Files changes"
There's a new dropdown called "Conversations", which seems to list all of them.
User ldog explains some limitations with this in the comments below:
Unfortunately this only works if the comments are in sync with the latest commit or the commits that you are currently looking at, if you wanted to see all comments across all commits, this doesn't work. For example, when clicking on a comment that no longer exists due to code changes in a commit this does nothing.
I would prefer to find the same solution the OP is seeking, but I wanted to share this for anyone else landing here with the same issue in case someone finds it helpful.
Also, I'm cross-posting this information in a related webapps.stackexchange question: https://webapps.stackexchange.com/questions/148308/how-to-always-show-all-pr-conversations-in-github

How to contribute to a GitHub open software repository?

I've been reading many tutorials, trying to figure out easy steps to the workflow for contributing to a GitHub repository using GitHub itself (I'm a Windows programmer, so I find the local git CLI extremely awkward, as well as much more complicated than working entirely remotely in GitHub).
I will post the steps as I discover and develop them in the answer below.
Please, I cannot do this on my own, as I barely know what I'm doing. Suggest edits to my answer, or post comments and I will edit.
Easy steps to contribute to an existing GitHub repository:
If there is not already an Issue posting describing the problem or code change, create one on the GitHub repository (repo) in the Issues section.
Create your own GitHub account, if you do not have one.
Go back to the GitHub repository (repo) and click the "Fork" button. This will create a copy of the entire repo in your account as your own repo with the same repo name.
In your new repo on GitHub, click on the button "Branch: master". Enter a name of your new branch (include the issue number) and press Enter to create a new branch for your changes.
In your new repo and your new branch, click on the file you wish to edit or click the "Create new file" button. Make your changes.
When you are happy with your changes, scroll down to the "Commit new file" section. The title can be something like "Created file FILENAME". Add a description of your changes, including the issue number. Click "Commit new file" button to commit your change before testing it. Repeat for any additional files.
At the repo (Code section), click the green "Clone or download" button. Download a zip file to use locally to build if needed and test your changes locally.
At the repo (Code section), you should now see a notice, "Your recently pushed branches:". This means that your edits in your own repo created a "recently pushed branch". Inside this notice is a green button "Compare & pull request". Take a deep breath and push it. You will now be at the "Open a pull request" page. This will automatically request that the owner of the repo accept your changes.
If you see a "checklist", edit it to reflect your work so far. Otherwise, describe your changes in detail, referencing the associated Issue posting.
Click the green "Submit pull request" button. This posts your entry in a conversation about this request. If there are no edit conflicts, you should also see a green checkmark icon and the words "This branch has no conflicts with the base branch".
Wait for a response from the repo owner.
This is as far as I've gotten.

GitHub: Create branch from an issue

Is there a way to create a branch from an issue from Github's website?
Once I select an issue, is there a way to create a branch from the site and then clone it? Or an alternative?
No way.
But if you want to create a new branch from web interface use official guide page.
Coming across this question in October 2022, there now is a way to do that directly in Github!
This functionality is apparently in public beta right now and subject to change, according to the GitHub documentation about it.
To try this feature, just navigate to an issue and open it.
Then, on the panel on the right side of the page, you can find a clickable button to "Create a branch". See the attached screenshot for an example.
FWIW: You can automate the creation of issue branches by installing Create Issue Branch (FD: I'm the author of this App/Action)

How to associate GitHub issues with a branch?

Nearly every issue I file on gh refers to code on a particular branch. Does github have any mechanism to link an issue to the branch?
I need to filter issues by branch, so I am not distracted by issues in other feature branches.
Is there a way to do this? I know milestones can be (ab)used to reach a similar effect, but things get really confusing when the branch becomes a pull request and it shows up as another issue.
References
Often times issues are dependent on other issues, or at least relate to them and you’d like to connect the two. You can reference issues by typing in a hashtag plus the issue number.
Hey #kneath, I think the problem started in #42
Issue in another repository? Just include the repository before the name like kneath/example-project#42.
One of the more interesting ways to use GitHub Issues is to reference issues directly from commits. Include the issue number inside of the commit message.
By prefacing your commits with “Fixes”, “Fixed”, “Fix”, “Closes”, “Closed”, or “Close” when the commit is merged into master, it will also automatically close the issue.
References make it possible to deeply connect the work being done with the bug being tracked, and are a great way to add visibility into the history of your project.
Since March 2022, you can:
Create a branch for an issue
You can now create a branch directly from an issue to begin development work that's correlated to that issue.
Branches connected to an issue are shown under the "Development" section, which has replaced "Linked pull requests", in the sidebar of an issue.
When you create a pull request for one of these branches, it is automatically linked to the issue.
For more information, see the documentation.
Here is an animated image showing how a branch is created for an issue.
After creation, the linked branch is shown in the Development section:
The OP asked:
I need to filter issues by branch, so I am not distracted by issues in other feature branches.
It is still in public beta, but the new Development section can help you list branches associated to issues:
So for any issue you need to work on, create a new branch:
Use labels to organize issues. They aren't inherently branch-specific, but you could make a tag for each branch if that is how you want them organized.
When you have admin access to the repository, there should be a button called 'manage labels' on the issue page. That will let you add, modify, or delete labels. You can apply labels to issues a few different ways. One way is to open the issue and click the labels button just to the right of the main body of text for the issue. Once you have created a label, it will appear on the left just above the manage labels button. You can click on each label to view all the issues that have been marked with that label.

Way to see the whole commit history of a repo in Egit/TortoiseGit?

I'm looking for a way to see, though egit, to the whole history of my current git repo. From what it looks like, egit's "Show in History" will only show commits up to the current commit. With this I mean that if I do commit1 and commit2 and then decide to do checkout of the first, running "Show in History" of the project will not show up commit2.
Is there any way that allows me to see the whole history of the repo? I guess that'll be somehting on the lines of the git log master console command.
In other words, if you do checkout at any time your initial commit, how are you supposed to later be able to checkout the newer commits if your history won't show them?
I've been checking out, and it seems TortoiseGit "suffers" from the same problem. Is it indeed a problem or is just me that's not doing thing as we're supposed to?
Thanks
There is actually a button Show all Branches and Tags in the Eclipse history view to show all commits. See screenshot for more detail:
(It was already mentioned by L2G, but i did not had enough reputation to post a comment there.)
I would just open up gitk --all and look at the top. This will show you the entire history. I haven't worked with the other tools but if they don't have an --all switch, use gitk.
Hope this helps.
If you look at the toolbar under the History tab, there's a little icon of a path forking into two downward arrows. Its tooltip says "Show All Branches and Tags." I think that will do what you want.
I was having this problem too.
There is a 'Git Reflog' view available on the latest versions (eclipse Luna Service Release 1 [4.4.1] with eGit 3.5.1).
For background see: http://aniszczyk.org/2011/06/26/git-reflog-and-eclipse/
I like to use the context menu when right clicking on the repo folder. Go to TortoiseGit -> Show Log