That said, I use both. Most of my commits etc. are on the CLI but I still switch to a GUI if I want to browse the repo or see more detailed diffs etc.
I usually need to double check open issues when making these messages and since I am already writing commits on the command line, having a split terminal or tab that can pull up active commits with a single line command and see them in a concise and clean format, it is super helpful and fast.
If you are already working in the command line all day long, then it makes perfect sense to have access to GitHub in the command line as well.
Another benefit is that most IDEs will have direct terminal access within the IDE, which means you can get relevant GitHub details about your project from within the IDE via the terminal, without needing to leave the IDE.
Lastly, the CLI version is far more concise and simple compared to the web version.
I am not hating the web version. I still use the web version plenty. But it is just another useful tool in the quiver that has plenty of use cases and simplifies workflow.
`gh pr create --web`
Saves me having to push my current branch, navigate to the repo page, hit the "create PR" button, etc.
I've been doing `git push -u origin HEAD` and then using my mouse to click on the "go here to create a PR" link that gets printed, which isn't too bad. Takes you right to the page where you can review the changeset before opening the PR. If I'm not actually ready to open a PR by the time I push upstream, I just open a draft instead.
My favorite is "git browse", which opens a browser for the current repo & branch. There are a few other commands that are probably useful but that I don't really do much with.
gh alias set pcw 'pr create --web'
and then just use gh pcw
to create a new PR. There's also sufficient smarts around forking or not, depending on write permissions on the upstream repo. gh pcw --base=development
It's also super quick to set up an alias, so I don't see why not.This type of alias seems on the fence for me, if was like 10x a day I'd definitely be on board but a few times a day is a gray area
One example that comes to mind - we used hub to hack together a quick security feature that errors out our CI/CD pipeline (which runs shell scripts) if there are any open PRs that are labeled "security" (i.e. Dependabot opening a PR to update a vulnerable library), which forces developers to keep their dependencies up-to-date in order to deploy into production.
GUI tools don't work as part of CI/CD pipelines.
Libraries in higher-level languages (e.g. Python) force you to make sure that there's a library for every tool that you work with - if a specific tool is missing a Python library, then you have to deal with that yourself. Shell scripting is much more productive for gluing multiple sets of tooling together, as long as the shell scripts remain of a maintainable length.
With this tool, I was able to do something similar using Github as the source of information instead[1].
I fetch the info using the gh tool, output the result into json, and use a python script to format the output which results in a decent looking automatically generated changelog[2].
It's not the most exciting thing, and I could have probably achieved it in a different way using the GraphQL API directly, but for the needs of the project this fit the bill and let me get on with the release.
[1] https://github.com/aurora-scheduler/aurora/blob/master/build...
[2] https://github.com/aurora-scheduler/aurora/blob/master/CHANG...
However, you can approximate visual representations of these things in a CLI - `git log --graph --pretty=oneline --decorate --abbrev-commit` will use ASCII characters to draw the DAG of commits.
Moreover, the GitHub web GUI is not "amazing". It's tolerable as far as web UIs go, but it's missing a lot of keyboard shortcuts (and none of them are customizable), has no built-in extensibility (the fact that you can inject your own scripts and stylesheets is a hack only at the display level, and an impractical one at that), EDIT: isn't scriptable, and is incredibly resource-intensive relative to a native application. The GitHub CLI allows you to manage the non-git parts of GitHub from the command-line (and make your own GitHub native client by extension) - which is desirable, given the above.
I don't think the GH web interface is even tolerable. Even Bitbucket, which really sucks, has a better one...
For me, being able to just note down in a text file an exact trace of what I've done is the gist of why CLIs are superior for my use. How do you even begin to keep track of what you do in a GUI? You could record video, but the information density is way too low for it to be useful, and it's worthless for automation.
A lot of my stuff gets automated by me first doing stuff manually, recording what I do in a script, and next time just running said script. That's just flat out not possible with most GUI tools, and even if it were, it's too cumbersome to be worth doing.
Often true for me as well. I like `tig`.
> What use case is better served by sticking to the cli?
Good question. Knowing the "why" of things is important. My answers:
1. Focus - Opening a browser and clicking around takes more patience. It tempts me to go update my company's internal documentation about something irrelevant to my current task.
A CLI lets you pipe things to grep which lets you focus on specific information you care about.
2. Memory - I can write aliases to help me remember my common workflows.
3. Automation - I can have a script check PRs for me. This reduces context switching and enables greater focus and productivity.
2. Is often unimportant if the GUI tool can make common workflows one or two clicks.
3. Having the CLI tools to automate stuff is great, but is not necessarily the best way to have an interactive session with a repository.
Some of the things I like about graphical interfaces for Git:
- The information density is usually (depending on the program) great - I can see local branches, remote branches, commits and tree diagram for the selected branch, all in less space than a terminal usually takes up.
- A bunch of actions are available by right-clicking on a relevant item, so I don’t have to remember commands and command-line flags etc and I can just get on with things.
- Some actions like “show me the diff between these two commits” are SO much easier that they become a viable way of working.
today I wanted to see the commit history and changes of a single file. I tried for 20 minutes to figure how to do that in sublime merge some of that searching online. Failed. Used the command line like I probably should have in the first place.
1. Selecting specific lines for a commit. 2. Stashes management 3. Rebasing branches, cherry picking commits.
It is possible to do a lot more with it, but for the most other operations I use command line or GitHub UI.
My favorite feature is ctrl+click 2 nodes in the git tree and immediately see file level diff which I can explore in vscode’s diff viewer.
For work, we use git flow with github PR (which I do on github website) and always work in feature branches. I am able to navigate git like a pro, cherry picking etc as needed without a problem. It even works well with git submodules.
If something goes unexpected, git graph is the best tool to figure out what happened and to be able to repair it.
Also, vscode handles merge conflicts in a way I can actually understand and correct without it slowing me down.
The GIT cli has the option to use an external diff helper if you prefer.
You know how a lot of people think merge commits (an important keystone in how easy Git makes it to read and write meaningful history) are inherently "confusing" or "messy", and try to avoid creating them? Well, if you look at them in Github's awful log interface, they sort of are! This doesn't seem like the fault of those developers, and it's not Git's fault, since it ships with powerful command-line and GUI tools for making sense of things.
There can be UI and sometime that's helpful, but all action contained therein will be available on cli, just because that's exactly what the UI calls.