Introduction

Git is very popular Version Control System used in many software projects today. In my opinion, it’s the best VCS available today.
In order to start your adventure with this tool, you should know its basic commands and features.
There are graphical tools, which allows to use Git without terminal, but I recommend you to use terminal. With CLI you can work faster, you can understand Git better and you have more control over your repository.

Basic commands

In my opinion, list presented below contains commands, which are used on daily basis and you should start journey with them.

Git hist

There is one more fancy feature, which allows you to display colorful and graphical representation of branches and commits.

You can assign this command to hist alias in your .gitconfig file. After that, you can type: git hist and this command will be executed.

You should see something similar to the log on the screen below.

git_hist_example

It’s a history of commits to AndEngine repository.

More advanced commands and features can be mastered after some work with basic Git stuff.

Resolving conflicts

It may happen that someone modified file and pushed changes into repository and after that we modified the same file in the same place and want to push our changes. In such case, we have to resolve conflicts and merge changes. Sometimes, its more convenient to resolve conflicts with graphical tools than editing raw files modified by Git. If you are using IDE provided by JetBrains (e.g. IntelliJ IDEA or Android Studio) you can use VCS tools built-in IDE. Just choose option VCS -> Git -> Merge changes... for program menu and you can merges via graphical interface. There are also other tools like Kdiff3 or Meld, but I personally prefer JetBrains tools.

Git flow

Last, but not least, remember to read about Git workflow and familiarize yourself with that concept:

Further learning

There are many Git tutorials and materials worth reading, which can help with extending knowledge about this VCS: