Sign in

Intro to Git/GitHub

Goal: push our telegram bot code to GitHub, so that we can collaborate and control our code.

What is Git and GitHub?

Git is a version control system that allows developers to collaborate; GitHub is where we host our source files on top of Git.

Imagine it as google spreadsheet for code, where multiple people can edit the spreadsheet and see a list of edit histories. Now, google spreadsheet are our developers’ GitHub and it is built on top of Excel Spreadsheet (well… not really, but just for illustrating the idea here) which is our Git.

We will want to organize our spreadsheets in to different folders for different purposes, i.e. one for our chatbot; and then we can share the folder with others. It is then very similar to repository, the place we host our collections of source files for a single project.

Now let’s set up our Git.

Step 0. Installing Git and create GitHub account

For installation, follow the instruction here: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

Then you can create your GitHub account here: https://github.com/join

Step 1. Clone our chatbot repository to your local

Now open your terminal for Mac or Git bash (search git bash in windows search bar!) for Windows.

Type below command:

cd /path/to/your/folder

git clone https://github.com/elsiefore/Elderly-Chatbot-Assistant

Now you should see a folder created.

Let’s go into the new folder by typing

cd Elderly-Chatbot-Assistant/

Note that this is a demo repository I created for use, you are most welcomed to create your own repository following https://docs.github.com/en/github/getting-started-with-github/quickstart/create-a-repo

Step 2. Make some changes and commit the file

Now make some changes to the files under the folder. Git has this concept called staging, where you put your files in a draft mode; before you commit your files.

Add your files to staging:

git add .

Commit your file:

git commit –m “message you want to label this commit”

Push your changes to GitHub server

git push

You can use the git status command to check at each step.

There are many other details, I found the handbook — https://guides.github.com/introduction/git-handbook/, to be a good starting point. You can also find a lot of videos on YouTube if you prefer some visuals.