Arduino projects and GitHub – How to clone, push / pull ,commit changes from computer to Github Repo
Firstly, you need to create a repository on github, the repository that youll, basically clone to your um computer, simply go to github.com and create a repository if you dont know how to do that. Ill. Just show you over here. You simply click to new repository. Give your repository a name and, like you know, choose the basic settings ill, just set it to private and add a readme file for your documentation and thats it. Those are the main settings, then you simply create a repository and, as you can see it has been created, you can see it on your profile now. The next step is to clone the repository which, basically, in simpler terms, means like to you know, bring a copy of your repository to your local, like to your computer. So just choose the location where you want to save the folder. I chose desktop and right click and select get bash. This will open your gitbatch command line and over here, youll write the clone command, which will basically kind of bring the repository to your computer. So over here, im. Writing the git clone command and just see the link copy, the exact same link of your repository. This is, which is where you can find the link and add it to your git bash command line. So you simply type out this link. The link of your repository to the command line and then, when youre done doing that, tutorial.get you press enter, and now you can check if its actually saved on your computer or not just go to the same location.
In my case, it was desktop so go to the same location, desktop and, as you can see, the folder called tutorial over here so successfully. We cloned the repository to our computer, so now lets say if youre getting started with your arduino project, basically create your first arduino file. You have it saved on your computer. Firstly, obviously you have to change your directory and you know change it to the new folder that you created. In my case it was called tutorial, so ill change. My directory and google tutorial now im in my tutorial folder all right, so this was uh. This is a dummy arduino file that i have saved on. My computer, like lets, say im doing skype in a project. This is the first arduino file that i created and now i want to add it to my github repo, so, firstly ill. This is saved in some other location on my computer. It was saved in documents so ill simply copy. This file and ill just um quickly copy it, and then you have to paste it to your folder, the tutorial folder, the folder, which was cloned from your github repo. You have to paste this file over. There is the folder and ill paste the arduino file over here now to update your repo, like the online repo to that it contains this new file as well theres. Three steps that you have to do ill, open the command line again and show you how to do it.
Basically, these are the three main commands that you do that you enter to update your github repo, with the changes that you did in your local in your computer, basically so ill just type out. The first command, which was get add all then press, enter then add the next command. You can name your commit its obviously a good practice to give them meaningful names so that it, you can understand your code later on and ill just give it a name and then press enter. So, as you can see, it says one file, change and youll see. Youll observe the changes so now. Finally, adding the get push and press enter now well see on our github profile, ill, just refresh the page and as you can see, the file has been added over here now, its very likely that you might not create your whole project in just one go right. You might want to make some changes and then youll want to update those changes to your github repo to basically track the whole process. So lets say this: is my arduino project right, ill, open the file press? Ok over here and open the project open the arduino project and lets say i make some changes to it. Like any give me any change ill. Just i think ill add a comment that says: changes like this is just an example. You make you update your code because youre not going to basically create your whole project in this one go right, so you save the changes and then you follow the same steps as i showed you earlier all right.
You open the get bash command line again, get back here and just double check if youre in the same directory or not as you can see above it says, desktop slash tutorial so im in the right directory then again add the same. Three comments. Get add oil press enter git, commit and ill, i think give it. The name second commit make sure you give them meaningful names because thatll help you or anyone else understand your code later on. So this was the second commit and finally ill push it to my repo get push oil and press enter now lets see if the changes were made to our repo or not ill, refresh the page, and now, as you can see, it says three gimmicks ive made Three commits now the first commit the creating the rip accounts. Has the first commit. So if i open the file again, you can see it has been updated, says it. It has the change which i made. So that was all i i hope i made it kind of easy for you and do let me know if theres any other thing.