Skip to content

III. using git

Git is a version control platform, in which all changes are documented.

Some useful deeper information is available at e.g., atlassian.com

In my Environment Setup I’ve described, how to setup git for windows and how to clone a remote repository to the local computer.
You can now work inside the local repository folder (e.g., add, edit, move or remove files and directories). The changes made, have to be synchronized with the remote repository folder.
Every changes made, are documented and it’s possible to revert changes made or also switch back to an earlier state of files which has been edited.

As you can read in this quick start guide
your local repository consists of three “trees” maintained by git.
the first one is your W o r k i n g D i r e c t o r y which holds the actual files.
the second one is the I n d e x which acts as a ” s t a g i n g “ area and
finally the H E A D which points to the last ” c o m m i t “ you’ve made.

in practice, it means:

After working in the local repository, we have to “add” the edited files/directories into the “staging area” and from the staging area we are able to “commit” them.
B U T finally we have to push the edited files/directories into the remote repository.

First, I show you, how to do that with the git-gui on windows 10 :

using the git-gui

open your file explorer and right click on your working directory

here you can see that I made two changes. I deleted a picture called “assignment-photo.jpg”

and edited a file “week01.md”

In the right window you can see the changes I made. Removed lines are marked with a red minus and added lines, with a green plus.

Now we have to stage the changed files to commit

As you can see, the files are now “staged” You can now enter a commit message and “commit” the changes

After committing them, the files don’t appear in the gui anymore, but finally you have to push the push button, to transfer the changes to the remote repository.

After a view days working with git, I got a message pop-up from git-gui.

This message can be confirmed with “yes”

The database is now compressed.

using git-bash

To make my life a little bit easier, I copied a link to git-bash to my desktop. In the “Start-in” field, I put the complete path to my local repository and in the Target field, I removed the “–cd-to-home” command. When I now start git-bash, I’m directly in my working directory

First, we can check the status by typing

git status

The red marked files are added or edited. To add them ALL into the staging area, we have to type

git add .

When we now type git status again, then we see, that the files are ready to commit

We commit them with

git commit -m "enter a commit message here"

And finally, we have to push them to the remote repository

git push