What is GIT - A Guide to GIT Basics. Git. A quick start to using basic operations with explanations

Git GUI

Included with git - Run git gui from the command line and Windows installer msysgit will add it to the start menu.

Git GUI can do most of what you need to do with git. Including scene changes, set up git and repositories, push changes, create/review/delete branches, merge and more.

One of my favorite features is the "script" and "script" shortcuts in the menu right button mouse, which allows you to capture certain parts of the file. You can achieve the same via git add -i , but I find it easier to use.

It's not the prettiest app, but it works on almost all platforms (Tcl/Tk based)

GitK

Also included in git. This is a git history viewer and allows you to visualize the history of a repository (including branches when they are created and merged). You can browse and search.

Pairs well with git-gui.

Gitnub

Mac OS X app. Basically equivalent to git log, but has some github integration (e.g. "Network View").

Looks nice and is suitable for Mac OS X. You can search the repositories. The biggest criticism of Gitnub is that it shows history in a linear fashion (one branch at a time) - it doesn't visualize branching and merging, which can be important with git, although this is a planned improvement.

GitX

Designed for "gitk cloning for OS X".

It can visualize non-linear branch history, make commits, browse and search, and also has some other nice features like the ability to "Quicklook" any file in any revision (press spacebar in file list view) export any file (using drag and drop) .

It is much better integrated into OS X than git-gui/gitk, and is fast and stable even with exceptionally large repositories.

The original git pieter repository has not been updated recently (more than a year at the time of writing). A more actively maintained branch is available in brotherbard/gitx - it adds " sidebar, select, pull, push, add remote, merge, select, reinstall, clone, clone to"

SmartGit

On home page:

SmartGit is an interface for distributed system Git version control runs on Windows, Mac OS X and Linux. SmartGit is designed for developers who prefer a graphical user interface through a command line client to be even more productive with git - the most powerful DVCS today.

TortoiseGit

Version of TortoiseSVN git for Windows users.

It ports TortoiseSVN to TortoiseGit. Latest version 1.2.1.0. This version can do normal task such as commit, show log, difference of two versions, create branch and tag, create patch etc. See ReleaseNotes for details. You are welcome to contribute to this project.

QGit

QGit is a git GUI viewer built in Qt/C++.

With qgit you will be able to view change history, view patch contents, and changed files graphically after various branch developments.

gitg

gitg - git repository viewer gtk+/GNOME orientation. One of the main challenges is to provide a more unified user experience for Git interfaces across multiple desktops. This does not mean a cross-platform application, but close collaboration with similar clients For others operating systems(eg GitX for OS X).

Peculiarities

  • View change history.
  • Process large repositories (loads a linux repository, 17000+ revisions, less than 1 second).
  • Commit changes.
  • Steps/uninstalled individual pieces.
  • Cancel changes.
  • Show colorization of changes in versions.
  • View the tree for a given version.
  • Export parts of the tree of a given version.
  • Supply any refspec that the command, such as "git log", can understand to build the history.
  • Show and switch between branches in history view.

Gitbox

Gitbox is a graphical Mac OS X interface for version control of the git system. In one window you can see the branches, history and work status of the directory.

Daily operations are easy: stage and transient changes via checkbox. Lock, pull, drain and press with one click. Double click change on show diff with FileMerge.app.

Gity

There isn't a lot of information on the Gity website, but the screenshots there show a fully functional open OS X git gui with open source code.

Meld is a visual delimitation and merging tool. You can compare two or three files and edit them in place (diffs update dynamically). You can compare two or three folders and run the comparison file. You can browse and preview the working copy from popular version management systems such as CVS, Subversion, Bazaar-ng and Mercurial [and Git].

Katana

A git GUI for OSX by Steve Dekorte.

Take a look at which remote branches have pull changes and local repos have push changes. The git operations add, commit, push, pull, mark and reset are supported, as well as visual differences and visual preview project hierarchy that highlights local changes and additions.

Free for 1 repository, $25 for more.

Sprout (formerly GitMac)

git build orientation is easy to use. Has its own Cocoa (mac-like) user interface, quick view repository, cloning, push/pull, fork/merge, visual diff, remote branches, easy access to the terminal, etc.

By making the most commonly used git actions intuitive and easy to perform, Sprout (formerly GitMac) makes git user-friendly. Compatible with most git workflows, Sprout is great for developers and developers, team collaboration, and advanced and novice users.

Tower

Rich GUI git for Mac OSX. 30-day free trial trial version, $59USD for a single-user license.

Resistance to change is a fundamental human trait. If Git didn't exist when you started working with version control systems, it's highly likely that you started with Subversion. People often say that Git is too difficult for beginners. However, I beg to differ with you.

In this article, I'll tell you how you can use Git to work with your projects. Let's assume that you are creating a project from scratch and want to use Git as your version control system. After introducing the basic commands, we'll look at how you can publish your code to GitHub.

In this article we will talk about basic things - how to initialize a project, how to manage new and already existing files, and how to store your code in the cloud. We'll skip some complicated stuff like branching since this article is aimed at beginners.

Installing Git

On the official Git website there is at various systems- Linux, Mac, Windows. In our case, we will use Ubuntu 13.04, and we will install Git via apt-get.

Sudo apt-get install git

Initial configuration

Let's create a directory in which we will work. You can also use Git to work on an existing project, in which case you won't have to create a demo directory as described below.

Mkdir my_git_project cd my_git_project

The first step is to initialize the Git repository in the project directory. You can do this with the init command, which creates a .git directory with all the information about your project.

Git config --global user.name "Shaumik" git config --global user.email " [email protected]" git config --global color.ui "auto"

It is worth noting that if you do not specify your address and name, the default values ​​will be used instead. In our case, the default values ​​will be donny and donny@ubuntu.

We also set the interface color to auto so that the output of Git commands will be colored. We add the --global prefix to these commands so that these values ​​are used system-wide and do not need to be set on a project-by-project basis.

Preparing files for commit

The next step is to create some files. You can use any text editor. Note that if you are initializing Git on an existing project, you do not need to do this step.

Checking the status of the repository

Now that you have files in your project, let's look at how Git handles them. To check the current status of the repository, use the git status command

Adding files to Git

At this point, Git is not keeping track of any of our files. You need to specifically add files to Git for this to happen. To do this, we will use the add command.

Git add my_file

Having checked the status of the repository, we see that one of the files has already been added to it.

To add multiple files, we use the following (note that we added the first file earlier, so we only add the remaining two).

Git add myfile2 myfile3

It is possible to use git add recursively, but be careful with this command. There are some files (such as compiled programs) that should not be added to version control. If you use git add recursively, such files will also end up in the repository.

Deleting files

Let's imagine that you accidentally added a file to the repository that should not have been there. Or you want to remove a file from the version control system. In general, the git rm command will not just remove a file from the repository, but will also physically remove it from disk. To make Git stop tracking a file but keep it on disk, use the following command:

Git rm --cached [filename]

Commit the changes

Once you have added everything necessary files, you can commit them to Git. Think of a commit as a snapshot of the state of the project at a certain stage, which you can return to at any point in time and see the state of the project at that moment. Each commit has a message associated with it, which is specified as an argument after the -m prefix

Git commit -m "My first commit"

Specify a message that will contain useful information, since they help to understand what exactly was changed within a given commit. Avoid some general messages, like “Rules bugs”. If you have a bug tracker, you can specify a message like “Bug #123 fixed.” Good practice- indicate the name of the branch or improvement in the message. For example, “Asset management - added the ability to generate PDF based on an asset” is a clear and intelligible message.

Git identifies a commit with a long hexadecimal number. Usually, there is no need to copy the entire line; the first 5-6 characters are enough to identify a specific commit. From the screenshot you can see that our commit is identified by the number 8dd76fc.

Further commits

Let's change a few files after we've committed them. After we have changed them, git status will report that we have changed files.

You can see what has changed in these files since the previous commit using the git diff command. If you want to view changes for specific file, you can use git diff<файл> .

It is necessary to index the changes and commit them. All changed project files can be added to a commit with the following command:

You can avoid using this command by adding the -a option to git commit . This command will index all changed files and commit them. But this approach can be quite dangerous, as you can mistakenly commit something you didn’t want to. For example, let's say you opened a file and accidentally changed it. When indexing changed files, you will be notified of changes in each file. But if you commit all the changed files without looking at help. git commit -a , then all files will be committed, including those that you did not want to commit.

Once you have indexed the files, you can start committing. As mentioned earlier, you can specify a message for a commit using the -m switch. But you can also specify multi-line comments using the git commit command, which opens a console editor for entering a comment.

Project management

To view the project history, you can use the following command:

It will display full story project in the form of a list of commits and information about them. The commit information contains the commit hash, author, time, and commit message. There are many types of git log command that you will need to become familiar with when using Git branching. To view the details of a specific commit and the files changed, run the following command:

Git show<хеш_коммита>

Where<хеш_коммита>- hexadecimal number associated with the commit. Because this manual Intended for beginners, we won't look at how to return the state to the time of a specific commit, or how to manage branches.

Distributed version control systems (DVCS) are gradually replacing centralized ones. If you haven't used one of them yet, now is the time to try.

In this article I will try to show how you can quickly start experimenting with git using the github.com website.

This article will not discuss the differences between different DVCS. Also, working with git will not be considered in detail; there are many on this topic good sources which I will provide at the end of the article.

So, the site github.com is positioned as a web project hosting service using the git version control system, as well as a social network for developers. Users can create an unlimited number of repositories, each of which is provided with a wiki, an issue tracking system, the ability to conduct code reviews and much more. GitHub on this moment is the most popular service of this kind, surpassing Sourceforge and Google Code.

For open-souce projects, use of the site is free. If you need to have private repositories, you can upgrade to a paid plan:

Let's start with registration. Follow the link github.com/signup/free and enter your data.
After registration, we are taken to the Dashboard of our account:

Now we don’t have a single repository, and we can either create a new repository, or fork from an existing someone else’s repository and lead our own development branch. Then, if desired, you can propose your changes to the author of the original repository (Pull request).

But first, let's install git and configure it to work with the site.

If you are working on Windows, download and install msysgit. This is the console version of git for Windows (further the story will be based on the example of this OS).
Instructions for MacOS X (eng)
Instructions for Linux (eng)
There should be no problems, just click Next everywhere. After installation, select from the Git Bash Explorer context menu:

Or via Git Bash.lnk in the folder with the installed program:

We enter our data and line break settings in the console:
git config --global user.name "your name"
git config --global user.email "your email"
git config --global core.autocrlf true
git config --global core.safecrlf true

By the way, I recommend taking a good interactive course on using git from the console. The course is completed in a few hours and provides the necessary basic skills.

For those who prefer gui, there are several such tools for working with git on Windows. The two main ones are SmartGit (cross-platform) and TortoiseGit. Both are good, and which one to use is a matter of taste. I will describe working with TortoiseGit.
For poppies there is also a choice of giu.

  • The official client from GitHub is still quite crude in my opinion.
  • GitX - I personally didn’t like it
  • GitBox - most follows the mac-way, I highly recommend trying it

About git in Russian:
habrahabr.ru/blogs/Git/106912 “A successful branching model for git” - translation of a good English article
githowto.com interactive course on working with git from the console
habrahabr.ru/blogs/Git/106912 “Why git” + discussion
habrahabr.ru/blogs/development/68341 “Git for those migrating from SVN” + discussion
habrahabr.ru/blogs/Git/75990 " Teamwork in git" + discussion
progit.org/book/ru Russian translation of the book “Pro Git” (not fully translated)
habrahabr.ru/blogs/Git/123111 instructions-cheat sheet for beginners
series of posts “inside git”
lib.custis.ru/%D0%9B%D0%B8%D0%BD%D1%83%D1%81_%D0%A2%D0%BE%D1%80%D0%B2%D0%B0%D0%BB %D1%8C%D0%B4%D1%81_%D0%BE_GIT_%D0%BD%D0%B0_Google_Talks Linus Torvalds on git
habrahabr.ru/blogs/Git/80909 book “The Magic of Git”

About git in English:
books

  • progit.org/book book “Pro Git”
  • rutracker.org/forum/viewtopic.php?t=2808582 book “Version Control with Git”, 2009, O"Reilly
  • book.git-scm.com book “Git Community Book”
  • rutracker.org/forum/viewtopic.php?t=2808843 book “Pragmatic Version Control Using Git”, 2008, T. Swicegood
  • rutracker.org/forum/viewtopic.php?t=3239579 book “Pragmatic Guide to Git”, 2010, T. Swicegood. The git version being described is 1.7.2.1. Book in double-page spread format - problem/solution

A version control system, or VCS, can greatly ease the work of developers trying to analyze changes and contributions to shared code. Simply put, a version control system is a key element in managing software customizations that meet the needs of a project. VCSs provide the ability to assign alpha or numeric values ​​to specific changes/revisions/updates. They can also provide information about timestamps and the ID of the person who made the changes. In this guide, we will tell you about the most commonly used version control system - GIT. You will learn what GIT is and what advantages it has over other VCS, and we will also talk about installing GIT on different systems and its correct use.

In 2005, Linus Torvalds (the man famous for creating Linux kernels OS) developed GIT for version control of the Linux kernel, however, a little later it was supported by another person, a Japanese software engineer, Junio ​​Hamano. Today, GIT is one of the most known systems open source version control, relied upon by millions of projects around the world (including both commercial and free projects). GIT is a completely free software that supports many operating systems such as Mac, Linux, Windows and Solaris. You can download the corresponding distributions from the official GIT website. Here are a few GIT functions worthy of mention:

  1. A distributed version control system, GIT follows the peer-to-peer principle – peer to peer(peer to peer) unlike other systems like Subversion (SVN), which is based on the client-server(client-server).
  2. GIT allows developers to have many completely independent code branches. Creating, deleting and merging these branches occurs without any problems and a lot of time.
  3. In GIT, all operations are atomic; this means that any action can be completely successful or fail (without any changes). This is really important because in some version control systems (like CVS), where actions are not atomic, some dangling operations across the entire repository can leave it in an unstable state.
  4. Unlike other VCSs such as SVN or CVS where metadata is stored in hidden folders(.cvs, .svn, etc.), in GIT all data is located in .git directories.
  5. It uses a data model that helps ensure the cryptographic integrity of everything present in the repository. Every time files are added or committed, they are generated checksums; a similar process occurs when they are extracted.
  6. Another excellent feature present in GIT is its index. Within the index, developers can format commits and review them before actually applying them.

So, perhaps, we have answered the question “What is GIT”.

It's quite easy to use. To get started, you can either create a new repository or add an existing one. Once installed, the git-init command will help you set up a new repository, or the git clone command will help you set up a user for a running copy of the local repository.

Step 1 - Installing GIT

This part of the guide will show you the simplest ways to install GIT on different operating systems:

Option 1 - Install GIT on Windows

Installing GIT on Windows is as easy as installing any other application; download the installer and run it. Follow these steps to install GIT on Windows:

  1. Visit this site and download the GIT installer for Windows.
  2. After downloading, run the installation double click mice. Follow the instructions on the screen, keep pressing Next and finally Finish (Finish) to complete the installation successfully.
  1. Run command line and enter following commands in the terminal:

THE NOTE! Don't forget to change John Smith And [email protected] to your own personal data. Any commits subsequently created will be associated with this data.

That's all you need to install GIT on Windows.

Option 2 - Install GIT on Mac

There are many ways to install GIT on Mac, and there is even a chance that GIT is already installed on your computer. If you have XCode installed; run the following command in terminal to check:

Git --version

If your result is similar to this git version 2.7.0 (Apple Git-66), then you can safely start working with GIT, if not, then follow these steps:

  1. Visit and download the latest installer for Mac.
  2. Follow the installer's instructions and complete the installation.

  1. Use the git –version command again to confirm that the installation was successful.
git config --global user.name "John Smith" git config --global user.email " [email protected]"

THE NOTE! Don't forget to change John Smith And [email protected]

Option 3 - Installing GIT on Linux

If you are Linux user, you should be able to install programs and packages on your computer using simple apt-get or yum install commands; Well, installing GIT is no different:

For Debian/Ubuntu users (apt-get):

  1. Open a terminal and run the following command:
sudo apt-get update sudo apt-get install git
  1. Verify that the installation is correct using the git –version command.
  2. Run the following commands in a terminal to set up your username and email address, which will be associated with your GIT account:
git config --global user.name "John Smith" git config --global user.email " [email protected]"

THE NOTE! Don't forget to change John Smith And [email protected] to your own data. Any future commits created will be linked to them.

Fedora (yum/dnf):

You can get GIT packages using both yum and dnf.

  1. Open a terminal and run the following commands:
sudo dnf install git sudo yum install git
  1. Verify that the installation is correct using git –version.
  2. Run the following commands in a terminal to set up your username and email address, which will be associated with your GIT account:
git config --global user.name "John Smith" git config --global user.email " [email protected]"

THE NOTE! Don't forget to change John Smith And [email protected] to your own data. Any future commits created will be linked to them.

Step 2 - Using GIT

Now that GIT is configured on your Windows device/ Mac / Linux, let's learn the basics of GIT and how you can get started with it.

  • Creating/configuring/cloning a repository:

A repository is one of the most powerful tools of any version control project. To turn any directory into a repository, GIT will help simple command git init<каталог>. After executing the command, a directory called .git should appear in the place where the command was executed.

If you already have a directory and want to add (clone) it, use the command git clone. To clone a local repository, use the following command:

Git clone /path/to/local/repository

If you plan to clone a remote repository use:

Git clone user.name@host:/path/to/remote/repository

If you have a Hostinger account, you can easily clone and manage your repository through the tool in Control panelsGIT. For example, you want to clone a GIT repository, just enter its address, select the branch, installation path and click the button Create.

Once creation is complete, you can manage your repository by clicking the button Control.

  • The working process:

Now that the repository is set up, let's talk about its structure. Each local repository consists of three trees: working directory– which consists of files, index– which plays the role of a place where all changes take place before they are applied and HEAD– which is a pointer to the user’s last commit. The workflow itself can be explained this way: the user adds a file or change from the working directory to the index, then after viewing and analyzing it, it is applied to HEAD.

  • Add and Commit commands:

Proposed changes or files are added to the index using the add command. Here is a simple command to add any file:

Git add<имя_файла>

If you are confident enough about the change to commit it to HEAD, you can use the commit command. To do this, use the following command:

Git commit –m “Add any message describing the commit here”

THE NOTE! Once the commit command is executed (from the working directory), the file will be committed to HEAD, however, it will not be sent to the remote repository; a separate command is used for this.

  • Further promotion of changes:

Once your changes have been committed (and if they are ready to be pushed to the original repository), you can use the push command.

After executing the git push origin master command from the working directory, all changes present in HEAD will be sent to the remote repository. In the above command, the value master should be changed to the name of the branch for which you want to commit changes.

However, if the existing repository has not yet been cloned and you want to establish a connection between your repository and the remote server, do so by running the following command:

Git remote add origin<сервер>

THE NOTE! Replace the value in code<сервер>to the address remote server, which you need at the moment.

After cloning, any changes made will be transferred to the corresponding server.

  • Branches:

Another excellent and advanced feature of GIT is the ability for developers and project managers to create multiple independent branches within a single project. The main goal of a branch is to develop functions that are isolated and do not affect each other. The standard branch in any project is always the master branch. Any number of branches can be created as needed and eventually merged into the master branch.

A new branch can be created using this command:

Git checkout -b feature_n *

feature_n this is the branch name

If you want to switch back to the master branch, use the following command:

Git checkout master

Any branch can be deleted using this command:

Git checkout -d feature_n

In order to make a branch available to other users, you must push it to the remote repository. To do this, enter this command:

Git push origin feature_n

  • Update and merge:

In case you need to update your local directory to its latest version from a remote repository, simply issue the git pull command.

To merge an active branch with another, use this command: git merge feature_n.

Whether you use pull or merge, GIT always tries to resolve conflicts on its own, but it doesn't always succeed. If the command fails, the user must resolve the conflict manually. Once you have edited the files (to resolve the conflict), mark them as merged using the command:

Git add<имя.файла>

If you want to view the differences before merging branches, the following command can be run:

Git diff<имя_ветки_источника> <имя_целевой_ветки>

  • Marking:

Before releasing updates or revisions to software, it is recommended that you create labels or tags for them. For execution of this action in GIT, run this command:

Git tag 1.1.0 1c2d2d56fa

1c2d2d56fa in the above command refers to the first 10 characters of the commit-id referenced by the tag. The commit ID or Commit ID can be found in the log.

  • Magazine:

You can study the history of the repository by looking at the journal. Command to call git log. To display commits made by a specific user, use:

Git log --author =Name

A compressed version of the log (one commit per line) can be viewed using the command:

Git log --pretty=oneline

To view modified files:

Git log --name-status

  • Replacing local changes:

If you somehow made a mess and want to undo the changes made to the file, carry out this process using the following command:

Git checkout --<имяфайла>

By running this command you will replace the changed data in the working tree with the latest data located in HEAD. Any changes that have already been added to the index will not be affected.

Conversely, if all local changes or commits should be removed and the local master branch should be linked to the latest history from the server, run the following commands:

Git fetch origin git reset --hard origin/master

It is natural for people to resist change. If you weren't introduced to Git when you first started working with version control systems, you probably feel more comfortable with Subversion (SVN).

People often say that Git is too difficult for beginners. However, I beg to differ on this.

In this tutorial I'll show you how to use Git in your projects. Let's say you're building a project from scratch and want to manage it using Git. Walking through the list of basic commands will give you an idea of ​​how to host your code in the cloud using GitHub.

In this article, we'll talk about the basics of Git - how to initialize your projects, how to manage new and existing files, and how to store your code in the cloud.

We won't touch on the relatively complex parts of Git, such as branching, since this lesson designed for beginners.

Installing Git

On the official Git website there is detailed information about installing it on Linux, Mac and Windows. In our case, we will use Ubuntu 13.04 for demonstration purposes, where we will install Git using apt-get:

sudo apt-get install git

Initial setup

Let's create a directory within which we will work. Alternatively, you can use Git to manage one of your existing projects; in this case you won't need to create a demo directory like below:

mkdir my_git_project cd my_git_project

The first step is to initialize Git in the directory. This can be done using the init command, which creates a .git directory containing all the Git-related information for your project.

git config --global user.name "Shaumik" git config --global user.email " [email protected]" git config --global color.ui "auto"

It is important to note that if you do not provide your name and email address, the default values ​​will be used. In our case, the default values ​​would be the username donny and the email address donny@ubuntu.

In addition, we set for color user interface set to auto , which will cause the output of Git commands to be color-coded.

The --global prefix before the commands is to avoid having to enter these configuration commands the next time we run a Git project on our system.

Preparing files for commit

The next step is to create the files in the directory. You can use, for example, text Vim editor. Note that if you are going to add Git to an already existing directory, you don't need to do this step:


Check repository status

Now that we have a few files in our repository, let's take a look at how Git handles them. In order to check the current status of the repository, you need to use the git status command:


Adding Files to Git for Tracking

We don't have any files to track with Git at this time. We need to add files specifically to Git in order to tell Git what to track.

Add files using the add command:

Checking the repository status again, we can see that one file has been added:


To add multiple files, you can use the following command entry (note that we added one more file for demonstration purposes):

git add myfile2 myfile3

You can use git add recursively, but be careful with this command. There are certain files (such as compiled files) that are typically stored outside of a Git repository.

If you use the add command recursively, it will add all such files if they exist in your repository.

Deleting files

But running a simple git rm command will not only remove the file from Git, but also from your local file system! To

Git has stopped tracking the file, but the file itself remains on your local system, run the following command:

git rm --cached

Commit changes

Once you've hosted your files, you can commit them to Git. Think of a commit as capturing a specific moment that you can return to to access your repository at that point.

You can attach a message to each commit, which is added using the -m prefix:

git commit -m "My first commit"


Supply commits useful messages because it will help you determine what you changed in that commit.

Avoid overly general messages like " Bugs fixed" If you have a task tracker, you can add messages like " Fixed bug #234».

It is good practice to use the branch name or feature name as a prefix to the commit message. For example, " Asset management: added function for generating PDF files assets” is a meaningful message.

Git identifies commits by adding a long hexadecimal number to each commit. As a rule, you don't need to copy the entire line; the first 5-6 characters are enough to identify your commit.

Note that in the screenshot our first commit is defined by code 8dd76fc.

Further commits

Now let's change a few files after our first commit. After changing them, we will see that as a result of running the git status command, Git has detected changes in the files that it monitors:


You can check changes to tracked files made in the last commit using the git diff command. If you want to view changes to specific file, use the git diff command :


You need to add these files again to make changes to the tracked files for the next commit. You can add all tracked files by running the command:

You can avoid using this command by using the -a prefix to the git commit command, which will add all changes to the tracked files.

This process, however, is very dangerous as it can harm the project. For example, let's say you open a file and change it by mistake.

If you place files selectively, you will notice changes in each file. But if you prefix -a to your commit, all files will be committed and you will not be able to detect possible errors.

Once you've placed your files, you can start committing. I mentioned that each commit can have a message associated with it, which we enter using the -m prefix.

However, it is possible to enter a message on multiple lines using the git commit command, which opens interactive form for recording:


Project management

To view the history of your project, you can run the following command:


This will show the entire history of the project, which is a list of all commits and information on them. Commit information includes the commit hash, author, time, and commit message. Eat various options git log , which you can explore once you've mastered the concept of a branch in Git.

To view detailed information about a specific commit and the files that were changed, run the following command:

git show

Where This hexadecimal number, associated with the commit. Since this tutorial is aimed at beginners, we won't cover how to go back to the state of a specific commit or how to manage branches.

Hosting code in the cloud

Now that you've learned how to manage the code on your system, it's time to host the code in the cloud.

Since Git doesn't have a central server like Subversion, you need to add each source to interact with the others. This is where the concept of remote comes into play. remote means remote version your repository.

If you want to host your code in the cloud, you can create a project on GitHub, GitLab, or BitBucket and push your existing code into a repository.