DEV Community

I use the GitHub Desktop app for one thing. Am I doing this wrong?

Ben Halpern on January 26, 2019

When I go to review a PR that cannot be purely evaluated on the code, I click this link: I've found that to be the most seamless way to check ou...
Collapse
 
coreyja profile image
Corey Alexander • Edited

Someone else mentioned hub github.com/github/hub but thought I'd provide an example! Once you have hub setup and authenticated with your Github account you can use a command like the following the checkout PR#123 for example

hub pr checkout 123

Not sure if this is easier than the web ui, since you have to find the PR number first, but at least that doesn't require scrolling all the way down the page!

Collapse
 
ben profile image
Ben Halpern

Cool. I have hub installed, I guess I just never used it this way. I'm curious whether the mental overhead of remembering the number and switching applications like that will be the right solution. I do quite like clicking a button, but I'll examine this as an approach.

Now that I'm thinking about it, this might be something I could do entirely in VSCode.

I just installed this, and I will give it a try:

Microsoft / vscode-pull-request-github

GitHub Pull Requests for Visual Studio Code

Review and manage your GitHub pull requests directly in VS Code

This extension allows you to review and manage GitHub pull requests in Visual Studio Code. The support includes:

  • Authenticating and connecting VS Code to GitHub.
  • Listing and browsing PRs from within VS Code.
  • Reviewing PRs from within VS Code with in-editor commenting.
  • Validating PRs from within VS Code with easy checkouts.
  • Terminal integration that enables UI and CLIs to co-exist.

Demo

Getting Started

It's easy to get started with GitHub Pull Requests for Visual Studio Code. Simply follow these steps to get started.

  1. Make sure you have VSCode version 1.27.0 or higher.
  2. Download the extension from the marketplace.
  3. Reload VS Code after the installation (click the reload button next to the extension).
  4. Open your desired GitHub repository.
  5. Go to the SCM Viewlet, and you should see the GitHub Pull Requests treeview. On the first load, it will appear collapsed…
Collapse
 
apjanke profile image
Andrew Janke

I use hub for this too, all the time. You can also just copy and paste the URL to the GitHub PR page and use that instead of the issue number in the hub checkout <whatever> command line.

Collapse
 
bnb profile image
Tierney Cyren

This is what I was going to suggest. I absolutely love this extension for this use case. One of my awesome-* repos used to have merge conflicts with basically every PR because of how I initially structured it (an OSS contributor came and restructured it to make this not happen anymore 💖) and this extension saved so much time when I started using it.

Collapse
 
daveskull81 profile image
dAVE Inden

That VS Code plugin could likely do what you need. If it does and that is all you use the Github desktop app for I would say replace it. But, if you like working the other way I would say stick with it. It’s hard to argue with the fact that it works and you get your desired results. I don’t think you should consider your approach “wrong” or “inappropriate” because just like most things with development there is multiple ways to get work done and that’s okay.

Collapse
 
tvanantwerp profile image
Tom VanAntwerp

If it works, it works!

I stopped using GitHub Desktop a while ago because it was oversimplifying some parts of git, which could cause weird errors (typically around merge conflicts, if I recall) and usually required the typical fix. I've since happily used GitKraken, which I find to be a phenomenal git GUI. (Yeah, yeah, not a real programmer, whatevs.)

Collapse
 
vampiire profile image
Vamp

What do you mean by can not be purely evaluated by reviewing the code? I’ve never used the desktop app. What does clicking that link help you achieve on the app?

If this is what you use to perform manual tests before merging you can just checkout the branch locally on your machine (from the CL) and then execute to test.

Collapse
 
moopet profile image
Ben Sinclair

I'm not clear on this bit either.

Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

To review PRs, I use what @maestromac showed me, which is running the git command:

git fetch upstream pull/pull-request-issue/head:name-of-branch-locally

So for example:

git fetch upstream pull/1579/head:1579-share-dropdown

I can never remember the full command though so I made it into a bash function:

rvpr() {
  # check if second argument was given
  if [ -z "$2" ]; then
    git fetch upstream pull/$1/head:$1-pull-request
  else
    git fetch upstream pull/$1/head:$1-$2
  fi
}

# to be used like:
rvpr 1579 share-dropdown
#=> an alias for git fetch upstream pull/1579/head:1579-share-dropdown
Collapse
 
itsasine profile image
ItsASine (Kayla)

Meanwhile, here I am only using Github Desktop at home to clone repos while I use Gitkracken for checking out merge requests haha. I'm starting to get in the habit of using Gitkracken for cloning, too, so I should probably just uninstall Github Desktop. Gitkracken supports multiple web origin types, so it's easier to keep GitLab and GitHub in one spot.

Collapse
 
wuz profile image
Conlin Durbin

Not sure this is exactly your use case, but I hacked together a way to checkout a PR branch in a local repo by clicking the "Open in Github Desktop" application. It's pretty hacky, but it works:

wuz / open-in-local-git

Use "Open in Github Desktop" to check out the branch in your local repo.

open-in-local-git

Use "Open in Github Desktop" to check out the branch in your local repo.

This is an electron app the overrides the Github desktop application protocol handler to checkout a git branch on your local machine when you click the "Open in Github Desktop" link on a Github Pull Request.

Caution: this might replace the normal Github Desktop functionality. If you use it for anything other than the "Open in Github Desktop" link you probably don't want to use this!

Inspired by this thread on dev.to

Head over to Releases to download!


If people are interested/this works for them, I'll keep up on the issues and try to add some new features.

Collapse
 
elmuerte profile image
Michiel Hendriks

There are so many things about git which baffle or confuse me that I'm not sure it fixes more problems than it creates.

Collapse
 
qm3ster profile image
Mihail Malo

Perhaps it is such a small link because the intended way to merge pull requests (according to GitHub) is probably from GitHub Desktop, without the browser step.