Featured
- Get link
- X
- Other Apps
How to upload code to GitHub with VS Code: a dive into Git
Today I wanted to make a how-to about GitHub and VS Code, version control is one of the hardest things for a beginner to learn, and this guide is for the beginners using VS Code. Offering to help them to understand how to upload their projects to GitHub and maintain it with commits, branches, and push + pull.
So, what is Git? Git is a version control system, version control is the idea of having a stable codebase and making changes via commits, and keeping changes in their zone via branches, then incorporating those changes by merging the feature branches with the main branch. Repositories are the homes of the code, branches, and everything else.
GitHub is a place to upload your code to share, collaborate, and release code to the world. It's remarkably similar to Git except GitHub is one of the most popular online clients for git, making it one of the best places to host, and upload code. For a better explanation of both concepts here's a link to an article that helped me:
With that out of the way let's start uploading to GitHub with VS Code!
First, open the folder that holds your code, in this case I put basic Html and CSS. For a guide on making files in VS Code here's a link to my guide:
Once you put the proper name for your repository decide whether you want the repository to be private or public and then press the "enter" on your keyboard. Another pop-up will appear asking you to click the checkboxes on what files you want to add to the repository from the original folder, do that and then press the "enter" key on your keyboard again.
You should see a little status bar telling you the upload status on GitHub! The Repository is now live on GitHub and it even includes a button to check it on the web! Now when you get back to the code you can see in the Git panel that there's some changes. Now it says changes and there are various tools above. The + button on each change is to stage the changes, once staged you can commit changes to the local repo.
Now let's say my friend is helping me with the webpage and he added an extra line of HTML, I need to work with that updated version of the code, what can I do? I can use the Git "pull" element in the same three dot menu that push was found in. Pull is self-descriptive; it pulls the latest changes made to the files by contributors and can be extremely useful when coding with others.
Now let's say we want to experiment with some new code, but we don't want to accidentally harm the original code. I can create a new branch to serve as an experimental branch where I can test the new code while the original stays safe. To do that press the "main" otherwise known as "branch" button that allows you to switch through branches and make a new branch whenever you want.
I'll go ahead and type the name of my branch and then press enter on the option to "create new branch", then whenever I want to switch branches I can simply click on "main" to go back to the main branch.
Now we see the repository complete with a commit, branch, and all our code. The code we wrote in VS code can be pushed, pulled, and edited by others. VS code has some of the best Git and GitHub integration in any code editor and I hope this guide has helped shown to make a repository to share your code and ideas with the world.
Best, BenTechCoder
Want to support the channel and Blog? You can Buy Me a coffee with the button below!
- Get link
- X
- Other Apps
Popular Posts
Lenovo Chromebook Duet review: Opportunity knocks
- Get link
- X
- Other Apps
Comments
Post a Comment
If have something to say go ahead and speak your mind but please do so with respect for others opinions.