Learning to link the files from the local storage to an online server is something every developer must learn. It should be as routinely done as offend as possible, just like “File > Save” for any project.
So here is what I have learnt:
After downloading Git and creating an online account with GitHub, follow through the setup of Git to complete the installation. “Git Bash” is the application you will be working on. There are several commands that are commonly utilized within Git:
- git - -help = would list out all the available commands
- git ls = to list all the available folders within the current directory
- git cd = to change the directory
- git pull = to take the files from the online repository into your local project
- git commit = to save the newly alterations
- git push = to update the repository with the new changes
But before anything can happen, we must first link git to GitHub. And to do that, we must first create a brand new repository online at GitHub. Create a new repository and give it a name. Once that is completed, GitHub would provide you with an link.
Back on Git, locate the proper directory folder and right click > Git Bash here. This is a shortcut that would skip the directory change/list. Type in “git init” to initialize the local files to be ready to be linked. Then type “git remote add <server name><GitHub provided Link>”
- As a common industry standard <server name> shall always be named “origin”
Once linked, there might be a pop-up asking you to sign into GitHub for security, do so and you shall have a fully link local to online repo.
Thinks to always remember:
Always Always Always remember to “Pull > Commit > Push.” Just because you saved on a local level, doesn’t mean it will be saved on the online repository. So always always update the online files by commit and pushing the updated files online after the local save. This is especially holds true when working with multiple people on the same project.