Quick Introduction to Git

I know this is maybe a little bit off topic Python, but this is absolutely basic knowledge for every programmer, whether you are programming in Python, Perl, C++, Java, HTML.

In the modern world of Software development, Git has become an essential part of the working process. In the following post I will describe to you why you need it and how to use it!

The why:

Once you start to get into regular programming you will notice more and more often that once you have programmed for some time and coffee is starting to have no effect on you, that you start to program bad code. The next day you want to see what you have done, try to run the script, and a list of 213 errors pop up. The code you did last has no comments, so you are having trouble understanding it, and will use the first 2 hours of your new day fixing the problems you did in the last hour of yesterday. Wouldn’t it be easy just to revert to a version of code that worked just fine? That’s where Git comes in, a simple and easy to learn Version Control System (VCS).

The how:

I will be using the git platform Gitlab(.com) for archiving my working process. Gitlab is a free webspace to store all your VCS data. First create a Gitlab account – it’s free. Secondly create a project, mine is called ADP (my shortcut for automated driving project).

The huge advantage of Git is, that you always have a local version, so you can work offline. To get this local version of your Gitlab, go to your terminal and type the command: git clone https://username@gitlab.com/username/adp.git #replace username with your name from gitlab.

You should be prompted to type in your password, that’s good, it means your data is private and no one other than you can access it.

Next type cd adt – to enter your local folder (or copy) of your Gitlab Repository. Create your first file by typing: touch README.md . This has now created the README file on your local disc. Our next job is to upload this file to your Gitlab account, this uploading is called push. Type git add README.md to add the README file to your „upload list“. Next we want to give your upload list a name, so you can find this version of upload later, do so by typing git commit -m „add README“ – the text „add README“ is the comment used to identify the version, you can call this „Version 1.1.9“ or „Bug fixes 08.05.2017“ – whatever you like. Finally, we need to upload your upload list and comment, type git push. That’s all, your done with your first Gitlab commit (upload).

I don’t want to go into this topic further, as there are millions of tutorials available 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s