DEV Community

Katie Walkowski
Katie Walkowski

Posted on

Getting used to GitHub using Git Bash and GitHub Desktop Client

Where to start

GitHub is something that developing programmers hear a lot but never know where to start. This post will teach you one of the fundamental first steps to using GitHub: committing. When a programmer takes a piece of code from GitHub, it usually means they want to make changes to it. Doing so is not so easy as hitting “save all” because that only stores it locally. As a result, we use the commit and push process to send any modifications made to the GitHub database which then replaces the existing file with the one with the changes.

Committing using Git Bash

There are multiple ways users can commit to GitHub, but one of the most seamless and popular methods is using Git Bash. Git Bash is a source control management system that acts as a command line for users to access GitHub’s database. The summed up steps that I normally take when modifying a repo is: cd into save folder/location cd desktop - cd ist402 > clone the repo git clone link to the repo that GitHub provides > make changes to the clone > re-open Git Bash > cd into the directory cd desktop - cd ist402> add the clone to the loading dock git add modifiedCode.in > Commit that the changes are accurate git commit -m “Quick description of the changes you made” > Push it to the DB git push > boom. Now that I’ve shown you the typical steps I take when committing, I’ll explain why I do each one. When starting on a new project, I need a safe place where I can save and edit files. I normally create a folder on my desktop and name it the project name. Using the cd command on Git Bash I can access these folders so I always make sure I’ve done this before I start. Next, I visit the repo on GitHub and click on the little green “code button”. It looks something like this. The link you see in the screenshot is what we use to let Git Bash know what to clone. I then clone it to get a duplicate so that I can do anything I want without breaking the repository. Once I’ve made all the changes I want and made sure my code is working, it’s time to populate the repo with my work of art. I pretty much already explained it but I then use the git add>commit>push combo to ship it through. The way I think about it is that it’s like mail. First I put my letter (clone) in an envelope (loading dock). Then I put it in a mailbox to be delivered (commit). Finally, the delivery driver (Git Bash) ships (push) the package to the destination (GitHub).

Using the Desktop Client

I just shoved a lot of information into the Git Bash section so I’m going to quickly break it down using the GitHub desktop client because it’s super easy. Initially, you’ll have to have it downloaded. You can do that at this link. It’ll prompt you to merge your GitHub account by signing in so do that (it's safe). Now any changes you make to files within your GitHub folder (mine was in my documents), will show up automatically in the client and display what was modified. You are also able to create new repositories and branches off them. Once you confirm that the changes made are accurate, on the bottom left side of the client there should be a little box where you can write any commit messages and a green commit button. Press that button and you’ve successfully committed using the GitHub desktop client. If you’d like a tutorial, you can watch here.

Top comments (0)