You Are Using GitHub WRONG!
You Are Using GitHub WRONG!
Table of Contents
You are using GitHub WRONG! GH Overview
| Sep 23, 2022 | Linux Windows MacOS Install GH
First Time Setup
GitHub is an incredible powerful tool, but using it in command line can be frustrating. So Set CLI to use SSH
instead of doing something dumb like using SSH agent workarounds or Token exporting Using GitHub Desktop
shenanigans to make git work in command line. We are going to use an amazing utility Using GitHub properly
Not combining git add,
called gh to authenticate.
commit, and push
Now before we continue, you might be thinking, I can just use password authentication. Well, Quick Aliases
Here is the error you get if you try that non-sense. Helping Projects
Walkthrough Video
Support for password authentication was removed on August 13, 2021.
Please use a personal access token instead. Copy
GH Overview
This utility was created by GitHub directly to manage authentication and has a lot of fantastic
features. So lets dive in…
Install GH
Debian Linux
Windows
Mac
Follow all the prompts and I’d recommend setting SSH as auth method.
Then I started doing some collaborative work and realized I’m terrible and most other people
are too on GitHub, because we are all doing it WRONG!
This should be everyone mantra, including me, but often I get caught up in my work and don’t
do it. So what is the big deal? Well, if you bundle a ton of different changes into one commit…
you have to revert ALL those changes if you had one bad one. Breaking those up into different
commits, you could just revert the bad code. That can literally save a project! I learned this
when I bundled a ton of changes into my ArchTitus project and basically turned it into a
spaghetti string of code that I hate looking at and debugging. To continue that project, I’d have
to rebase and wipe out a ton of progress I’ve made and other people have contributed. This
makes everyone mad and is simply not fun.
So follow that golden rule and realize you will fail at it, but realize your failures and do better
the next time is how we elevate ourselves to the next level.
Quick Aliases
These are some quality of life improvements that will make using git from command line so
much better.
I use bashrc these days and these are some aliases I added to my ~/.bashrc le.
gcom() {
git add .
git commit -m "$1"
}
lazyg() {
git add .
git commit -m "$1"
git push
} Copy
Now in a perfect world I would be using gcom "commit message" several times a day and then
nally using lazyg "last commit of the day" to push my changes public after I’m done.
However, the world and myself are far from perfect, but understanding what perfection would
look like will help you know when you aren’t.
Helping Projects
A poorly documented issue is pointless and just gets closed in every project. Don’t be that
person! Document what you can and if you noticed a recent commit messed something up
reference it by doing a copy paste of the Pull Request # like so. First, get to this screen by
clicking “## commits” in top right of the project main page. Then copy the SHA from the “bad”
commit.
From here, you simply make your issue and paste that long sha hash in where you want to
reference it. Don’t worry the numbers will be truncated and it will look awesome in the issue
page.
Also make sure you don’t just put a WALL OF TEXT! Try to make your issue readable by
breaking up your issue if it is more than several sentences long. This just makes it more
readable and make it as concise as possible.
Walkthrough Video
#GitHub
See Also
How to Use SSH with Github
Privacy