Basic Git Operations

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is also easy to learn and has a tiny footprint with lightning fast performance.

(See also Basic SVN Operations)

Git Advantages:

  • Better support to paralell development
  • Possible to make changes and not to affect other users work
  • Doesn’t require network
  • Branch is effective and does not “torture” users
  • Faster than SVN
  • Faster access to logs and revisions because everything is on a local machine

Git Concepts:

  • History of changes for all users
  • Complete data of the repository
  • Doesn’t require to user has an active Internet connection
  • Working Tree: Every user has his own work directory

Basic Git Operations:

Note: Repository must be initialized

Execute in a directory which we’ll use for versioning.

Inside that directory will be created subdirectory .git which contains all informations about repository.

Makes folder under GIT control on server

Adds main shared repository.

Checks files state. (unregistered files, changes in files, adding files)

Adds a single file to versioning.

Adds all files from directory into versioning.

Before commit, files must be added  to the stage.

Commit is a point in GIT repository history which contains set of one or group of files.

It is necessary to add a comment with commit.

Avoiding stage.

View GIT log.

Removes specified file.

Removes tracking but keeps file in directory.

Rename file with new_filename.

Removing file from stage.

File stays changed but doesn’t participate in commit.

Discarding changes in file.

File is returning to version in commit before.


Working with others

Gets remote repository.

Gets all changes from remote repository.

Sends all commits to remote repository.

Starts tool for merging in conflicts.


Branching Operations

Branches are used for parallel development in more independent streams of the same repositories.

Creates new branch with specified name and if branch exists, goes to that branch.

Returns to main directory.


Git Usage Example

Here is an example how to use GIT:

For more informations visit official Git website:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *