DEV Community

nzp126
nzp126

Posted on • Updated on

Committing to GitHub using GitBash/GitHub Desktop Client

The Basics

Working your way around GitHub can sometimes be a daunting task. There are seemingly infinite ways to upload, update and create files using Git. GitHub's main function comes in the form of repositories: essentially folders that house almost all amounts or types of information. The way these folders are accessed and modified is what you clicked on this blog post for, so let's get into it.

Git Bash

Git Bash is a source control management system (command line), that allows for easy storage management. You can download Git Bash here and once that downloads, I'll walk through the steps I took in order to commit using the command line. To start, I wanted to create the test repository I made using the clone command. To do that, I first got the link to my repository that GitHub offers me under the "code" tab, then copy and pasting that link into Git Bash like so: git clone https://github.com/nzp126/GDDemo.git. Now before I continue, I need to add that I modified a txt file within my repository in order for the Git Bash to display that a change had been made. Now that I have my file that's modified, I want to select that file in order to push it to the master branch on GitHub's server. The command for this is git add yourFileName.txt. This command places the file in the staging area right before implementation. This basically says the file is ready to be committed but is waiting in order to give the user more time to add more files to change if need be. Now that the file's ready we can now commit that file by using the command git commit -m "first version edit of the text file". The -m makes sure there's a comment being added to the commit so another user working on the same repo knows what's going on. All that is left to do is push it to the main server by using git push. You have now made your first commit using the Git Bash!

GitHub Desktop Client

Think that was hard? Good, this will be super easy. In order to make commits using the desktop client, first, download it from here. Next, you will need to sign in to your GitHub account in order to link your repositories. After that comes the easy part, make all the changes in the world! Within your main GitHub folder with your repositories, any changes you make will automatically display on the desktop client. You are also able to create repositories right on the client and make changes to those repositories at any point. Once these steps are complete, on the left side of your screen, it should show the files that changes were made to, and below that, a spot to put the summary of your commit and a description of what is being done to the file. We're cookin' with Crisco now time to push it - to GitHub. Parallel with the "changed file" tab, should be a button that says "Update Origin" which will update the repository on the GitHub server. Congrats you just learned how to commit using the desktop client!

Links

If you get stuck, follow along!
YouTube

Top comments (0)