So how does the CLI help us in web development, exactly? The previous two posts are meant to get you comfortable with using the CLI. Now, let's take a look at some cool stuff you can do with it for your projects.
GitHub is, as the name might imply a hub for git. More than 200 million repositories exist on this platform. It's a place where you can explore what other developers are up to from all around the world.
Starting from new projects, old projects, the Apollo 11 lunar module computer source code (woah), problems found within projects, their resolutions. Questions, tips, advice, creativity - all of that and more can be found on GitHub.
If you don't have an account yet, this is the moment I'd suggest creating one.
Let's use our CLI and Git skills to put our own code on to it!
After you've created your account or even if you've just had glimpses of what code stored on GitHub visually looks like, you might've felt overwhelmed from all of the buttons, all of the text, the tabs, links etc. It's natural.
Usually you won't use most of the given features, but I do suggest to just explore at your own pace and see what cool stuff you can find. It might take a good minute though, but don't worry.
The first thing I want to direct your attention to, is the page called "Your Repositories" and as the name implies, it's where all of your code that you have uploaded is found.
Currently it's most likely empty and sad, so let's change that.
So press the green "New" button at the top right. Then enter a name for your repository, it can be whatever you want.
If you wish for your newbie repositories to never make it to the digital sunlight, choose "Private" when creating one.
None of the bottom checkboxes matter currently, we'll go over those in a later post.
Then press "Create repository".
Now you should see something like the above. There's 3 ways to get stuff in your freshly created repo. Let's start with the first one.
Now let's create a new folder anywhere on your PC. Then open the CLI in there.
Tip: You can open the Command Prompt from the Windows key and just typing "CMD" and then just copy the folder path from the address bar in the file explorer and write:
cdand then paste the folder path in.
Tip: You can also hold Shift and right-click inside the folder on the background and select "Open PowerShell window here" and you'll automatically be in the folder. PowerShell is just a beefier version of Command Prompt.
Then just execute the lines show in GitHub one by one if you're using the Command Prompt. If you're using PowerShell, you can just click the clipboard button to copy the entire snippet and you can paste and execute all of the lines at the same time. Told you PowerShell is beefier.
You can right-click the folder background again to open it with Visual Studio Code. Once you do, you will notice that the repo is initialized and you're on the "main" aka "master" branch already.
You also have the default README file. This file contains the instructions on how to use your code or atleast what the code is about.
Now add any text you'd like about the project that you're probably going to continue building in this repo.
Then do a commit as usual.
Then it's time to
push your code to your GitHub repository!
So press F1 and start typing "push" and a "Git: Push" option should show up. Select it and press "Enter".
Alternatively you can just look in the bottom right corner and see these arrows below and just click on them:
Now when you go back to your repository page on GitHub and probably need to press F5 to refresh the page - you should see your updated README be displayed in the center of the screen.
Congrats! You've now joined the 65+ million developers that hold their code on GitHub! 🎉
With your code in GitHub you have pretty much enabled anyone on GitHub (or even outside if your repo is public) to time travel and collaborate in your repository.
You can now start planning and creating your catalogue of projects aka portfolio and prove to any employer that you have what it takes!
You can now work on stuff with your friends or contribute to open source projects with strangers!
Aswell as having the peace of mind that your code is version controlled and backed up to the cloud.