Growing with Git — Git Bash


Greetings, friends! Welcome back, and thank you again for joining me. In our first installation of “Growing with Git”, we scratched the tip of the Git iceberg. We downloaded the Git software onto our Windows PC and created our first repository on the GitHub website. After pulling our new repository, we made a small change to the README file and committed then pushed the changes back up to the online repository. While we did all this with the Git GUI, we also noted there is another way to work within the Git functionality: Git Bash.

Cloning with Bash

Since we ended our last tutorial by updating a repository on GitHub, let’s use that as our starting place. For demonstration sake, let’s say we built a repository at home but now we’re at on a separate machine and we want to pull the repository. To do this, we’ll need two things.

First, we’ll need to open the project on GitHub. On the main page, click the green “Code” button; this produces a dropdown box with an https:// address for our project. To the right of the address, GitHub provides a button we can click to copy the address.

Second, we’ll open Git Bash terminal (Start > Git > Git Bash). With the copied address in hand, navigate to the parent folder where we want the new repository to be added. For example, I want the folder containing my repository to reside on the Desktop, so I navigate to the Desktop folder. Next, we’ll use Git’s clone command in conjunction with the copied https address. Enter the following command within the Git Bash window:

git clone

The process looks something like this:

Once we issue this command, the cloning process begins, and the clone status is listed below our command. Note that this may require signing into GitHub, but since we’re already signed in, the authentication is immediate.

Making changes

At this point, we can navigate to the Desktop and confirm that our repository has been placed there. In my case, I see that a new folder (“GrowWithGit”) has been created. and creates all the files contained in the online repository. At this point, we can modify the files as we see fit. To keep things simple, I’ve chosen to simply update the README file in a text editor.

To ensure Git is tracking the document, we’ll run a quick status check on all the documents within the repository by running the command git status within Git Bash. Then we’ll make a quick change to the document, save the document, and re-run the git status command in Git Bash. We see that it immediately picks up the changes we’ve made, correctly saying we’ve only changed the file.

Saving changes

As in our last tutorial, we want to make sure to save our work both locally and in the online repository. Similar to the Git GUI, we’ll still need to stage the files we want to update online, and we can do this with the add command. If we want to add (or stage) all of our changed files, we can simply add a . afterwards to indicate “all”:

$ git add .

With all of our files staged, we then commit the files; here, the -m flag lets us add a descriptive message, similar to the message we wrote in the GUI textbox. When the command is executed, Git confirms we’ve changed one file (, with 2 insertions (or lines).

$ git commit -m "Adding new comment to file."

[main 9b20867] Adding new comment to file.
 1 file changed, 2 insertions(+)

Finally, our committed files can be pushed to GitHub using the syntax git push origin <branch>. Executing the command then returns status information.


In this tutorial, we jumped feet first into the other tool Git offers to help us keep our code consistent: Git Bash. While it may look scary at first, I’ve found that once you get used to the commands, the Bash interface offers you much more flexibility and control over how code is updated, and which codes are updated.

So now we have the ability to pull code from a repository, edit the code locally, and push changes back up to the remote repository. But this leaves one glaring question to be answered: What happens when there are conflicts between the remote repository and the local repository? Join me in our next tutorial where we walk through a couple different conflict scenarios, exploring how we can use Git Bash to resolve merge conflicts in a fast and easy manner.

Again, thank you so much for learning with me! I hope you’re getting as much out of this as I am. Please feel free to subscribe for updates, like, or comment on my material! I also invite you to look at my other tutorials in Blender, math, optimization, LaTeX, and many others. Have a great week!

Get new content delivered directly to your inbox.

%d bloggers like this: