Introduction to Git

From ELC Wiki
Jump to navigation Jump to search
GitLogo.png

Git is a version control system that can be used to track changes to files, allowing you to revert to a specific file version and monitor how the file changes over time. It is most commonly used in source code development but can be used in many other scenarios such as tracking changes to documentation and even binary files. There is a large quantity of information online about the usage of Git, the official Git documentation is a good place to start, but there a numerous other resources as Git is now one of the most commonly used version control systems for software development. As the Git system is largely aimed at usage from the command line, there are many third party graphical user interfaces (as well as an official one) that make usage a little bit easier for beginners, to mention a couple, Tortoise Git and Sourcetree are both good free ones. The focus of this page will be on Tortoise Git.

Overview

Git is intended to be used by either a single developer or a large group of different developers often working in different places. If a repository is accessible to the public, anyone can "clone" it, which means download a complete copy of the repository, including all of the information regarding any changes to it since it was started. This means that even if a version of some software has reached version 10, you can still set your repository to be back in the same state that it was when the software was at version 2, 6, or any other tracked change point.

A few important key things to remember about the workings of Git:

  • Each developer has a complete local copy of all files in the repository at all times
  • When working in a team, there will be a centrally accessible primary repository that all users upload new changes to, and download other people's changes from
  • You can choose when you synchronize you local copy of the files with the primary repository
  • When a developer wants to control who changes the contents of the primary repository, he/she may make it read only so only new changes can be downloaded

A few important pieces of Git terminology and their roles in the workflow:

  • The process of downloading new changes from a central repository is called a "pull"
  • The process of uploading new changes to a central repository is called a "push"
  • Central repositories are known as "remotes"
  • When you make changes to your local copy of the repository, these changes are not tracked until you "commit" them.
  • Only changes that have been "committed" can be "pushed" or "pulled" to or from a central repository
  • Before you "push" or "pull" any changes, your local repository must have no uncommitted changes.

Using Tortoise Git

Cloning a Repository

Viewing the change log

Moving to between versions