GitHub Essentials — 2024 Edition
Hello and welcome. A few years ago, I wrote a blog post with all the github essentials. This is simply an update and remake of that post with some changes and updates.
Find the original, here.
Now, let’s move on with this remake then.
Item 1 — Install Git (on Windows only)
This one is straight forward but not neccessary. The thing about universal things like Git tech, is that, there are always multiple ways to skin the cat. I personal like to use Git, especially for the initial setup and cloning of a new repository.
Find the git to install here — https://git-scm.com
On Mac, don't install anything. The built-in terminal on Mac is all powerful and amazing.
Item 2 — Install Visual Studio Code
This one is another no brainer. Although, I usually use Git command line for cloning a fresh repository, post cloning, I stick to using the built in terminal in visual studio for running all git commands.
Also, there are several git extensions which help with Git Flow like authentication, GitHub Actions and so on. Very useful.
So, for cloning, use Git SCM. After that, use the VS Code terminal for all post cloning git activities.
Item 3a — First Time Repository and Cloning
note: I realized that I never wrote how to get started with a new repository. so, updating this on November 6th, 2022.
First, you want to create a ‘private’ repository in your new GitHub account. It’s very important that you do the ‘private’ repo.
Then, get the clone URL from the ‘green’ button. it will look something like this.
https://github.com/Jay-study-nildana/bootstrapexpert.git
Right then. you want to clone it on your computer, either using gitbash or VS Code terminal.
git clone https://github.com/Jay-study-nildana/bootstrapexpert.git
after cloning is successful, remember to open the folder inside the repository (not outside) from your VS Code. Otherwise, you will keep trying to use git in a folder that contains the repository folder, not the actual repository.
Item 3 b — Essential commands
For this, I am assuming that you have opened the folder (which contains your practice code, practice project, practice repo) in VS Code, and have already opened the terminal at the bottom.
git status
- I do this frequently and all the time. Allows you to check and avoid git conflicts.
git add .
Adds everything in the current working folder.
git commit
commits what you have added in step 2.
Now, you are in the terminal window.
At this point, you want to PRESS the letter ‘a’ with your left hand.
Now, you will come into an unusual looking presentation. Just roll with it. You know, you should at least type two paragraphs.
The first paragraph (which should be a simple line, preferably short, like 2 to 6 words) is like the title of a paragraph.
The second paragraph (or multiple paragraphs if you want to get into story writing mode), is where you put all the details of the current commit.
Further, I usually use a simple ‘interim commit’ as both title and paragraph when I am doing a quick, safety commit.
By now you are done with typing of your commits (at least two lines),
use your left hand, and press, Esc.
Now you are going to do,
with your right hand, Shift and ‘:’ (colon key).
Now, go ahead and type.
wq
w is for save/write. q is for quit. Now, you are out of that weird typing interface and should be back to your terminal.
Last step.
git push
This pushes all the changes along with the commit message. And, you are done.
Item 5 — Other Things
- For some bizarre reason, people seem to keep forgetting their GitHub passwords. Please, please, write down your password somewhere.
- Also, remember that by default, new repositories (at least in my experience) are public. Ensure that it is set to private.
- Enable 2 factor authentication. You may be working on a simple project, but, always good to get the basics of securing your code from your young, early days of development.
- Remember that, when you delete a repository, you lose those nice ‘green dots’ of committing on your github profile. If you no longer like a repository, instead of deleting, consider archiving it.
- Learn basic markup. Put a readme.md file in each and every project folder. Don’t create folders without readme.md. It just makes the whole thing ugly, and makes you look like a lazy developer. Both the web editor on GitHub, and the VS Code, have very good, preview options for what you are typing. Make the most of them, and get better at marking up.
- GitHub is almost like a social media these days. Follow interesting people (hey, you can follow me here — https://github.com/Jay-study-nildana).
- Also, begin ‘star’-ing projects that you like. Every day, I learn about new, useful and money making repositories due to GitHub recommendations.
- Never feel like you are too small to raise a pull request on big projects. I am, at best, a below average coder and developer.
- Yet, even with my limited programming skills, some of my pull requests have been accepted on big open source projects like Microsoft repositories. No contribution is too small, and it always makes you feel better. Like when some Microsoft Program Manager from US replies to your pull request and says thanks. Thats a cool feeling.
And, that’s all there is to it.
I work as a coding tutor. You can hire me on Upwork, Fiverr and Codementor. You can also book a session on calendly, and visit my website. Also, video tutorials on my YouTube Channel.