“What is going on here?” I seemed to be asking my creator.
Like I said earlier, it is quite difficult not to get unnecessarily overwhelmed by several tools and stuff one needs to master as a beginner. Having to worry about Git and Github was absolutely not something I was expecting until I did my first task in a Bootcamp and had to move everything to Git.
Apparently, to push codes on Git from your machine (yea, makes sense that my PC is what is called a machine) you need to run a series of codes from your machine’s terminal or get GitBash to run it for you.
git add . git commit -m "<your message here>" git push
While I understand that it will help a fresh developer a lot to master git commands. I think it is ill-conceived and sometimes counterproductive to their learning goals. So, after using command line a couple of times I came across a very easy way to go about pushing my codes from my machine to Git.
The easier alternative to using the Git command line is a very intuitive one that gets the job done without a single line of code. Of course, I am assuming that as a new developer, the only thing you do on Github is to push and fork new and existing projects.
- Download and install GitHub Desktop
- Download a text editor, since we are all about intuitive and easy to use tools, I suggest VS Code. You can get it here.
- Create a folder where you will save all your code.
- Open your VS Code. Drag and drop the folder you opened inside the VS Code. Let’s name it codefolder. Create another folder, let’s call this one gitfolder. Abandon your gitfolder for now
- After you’ve saved all your files in your code folder. Go to github.com (not your github desktop). Create a new repository
- Make sure you didn’t add anything while creating your repository (leave the add README uncheck.
- On the next page, click on set up in desktop.
- That will take you to a dialogue box on your desktop. On the dialogue box, make sure you select URL at the top (Other options include “Github.com” and “Github Enterprise Server”) and your local path is gitfolder that we created earlier.
- Click clone.
- Now, copy and paste your codefolder or individual files inside it to your gitfolder.
- Go back to your Github Desktop and you will see that your codes have been added to it.
- At the summary side (left-bottom corner), type “initial commit” into the placeholder and click on commit to master.
- All you have to do now is to press the publish branch button.
- Congrats, your files are now on github. Go back to github.com to confirm it.
I know that this may seem like along method because of the number of lines I used in explaining it, but in reality, it takes less than a minute (and way less if you’re lazy like me) when practising it in real life.
As I’ve said earlier, this doesn’t mean you should not learn your git commands. Happy coding.