What is Git
By far the most widely used modern version control system in the world today is Git. Git is a mature, actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel. An overwhelming number of software projects rely on Git for version control, including commercial projects as well as open source. Developers who have worked with Git are well represented in the pool of available software development talent, and it works well on a variety of operating systems and IDEs (Integrated Development Environments).Git has a distributed architecture and is an example of a DVCS (hence a distributed version control system). Rather than having a single location for the complete version history of software, as is common in once-popular version control systems such as CVS or Subversion (also known as SVN), in Git each developer’s working copy of code is also a repository that can contain the complete history of all changes.
Git was designed not only to be distributed, but also with performance, security, and flexibility in mind.
The raw performance characteristics of Git are very strong compared to many alternatives. Committing new changes, branching, merging, and comparing previous versions are all optimized for performance. The algorithms implemented in Git use in-depth knowledge of common attributes of real source code file trees, how they are typically modified over time, and what the access patterns are.
Unlike some version control programs, Git is not fooled by the names of files when determining the memory and version history of the file tree, but focuses on the file contents themselves. Finally, source code files are frequently renamed, split, and rearranged. Git’s repository file object format uses a combination of delta encoding (storing content differences), compression, and explicitly stores directory contents and version metadata objects.
Distribution also enables significant performance benefits.
Suppose a developer, Alice, makes changes to the source code, adds a feature for the upcoming 2.0 release, and then commits those changes with descriptive messages. She then works on a second feature and incorporates those changes as well. These are, of course, stored as separate pieces of work in the version history. Alice then moves to the version 1.3 branch of the same software to fix a bug that only affects that older version. The purpose of this is to enable Alice’s team to deliver a bug fix version, version 1.3.1, before version 2.0 is ready. Alice can then return to the 2.0 branch to continue working on new features for 2.0, all without network access and thus quickly and reliably. She could even do it on a plane. When she is ready to send all the individually committed changes to the remote repository, Alice can “push” them with a single command.
Git was designed with the integrity of managed source code as a top priority. The contents of files, as well as the true relationships between files and directories, versions, tags, and commits, all of these objects in the Git repository are secured using a cryptographically secure hashing algorithm called SHA1. This protects the code and change history from both accidental and malicious changes, and ensures that the history is fully traceable.
With Git, you can be sure that you have an authentic content history of your source code.
Some other version control systems do not provide protection against a secret change at a later date. This can be a serious information security vulnerability for any organization that relies on software development.
One of Git’s key design goals is flexibility. Git is flexible in several ways: in its support for various types of nonlinear development workflows, in its efficiency in small and large projects, and in its compatibility with many existing systems and protocols.
Git is designed to support branching and tagging as a first-class citizen (as opposed to SVN), and operations involving branches and tags (such as merging or reverting) are also stored as part of the change history. Not all version control systems provide this level of tracking.
Version control with Git
Git is the best choice for most software teams today. While every team is different and should do their own analysis, here are the main reasons why version control with Git is preferred over alternatives:
Git is good
Git provides the functionality, performance, security and flexibility that most teams and individual developers need. These attributes of Git are described above. When compared directly to most other alternatives, many teams find Git very favourable.
Install Git on Windows
Git for Windows Standalone Installer
- Download the latest Git for Windows installer.
- Once you have successfully launched the installer, you should see the Git Setup Wizard screen. Follow the Next and Finish instructions to complete the installation. The default options are pretty reasonable for most users.
- Open a command prompt (or Git Bash if you chose not to use Git from the Windows command prompt during installation).
- Run the following commands to configure your Git username and email with the following commands, and replace Emma’s name with your own. These details will be associated with all commits you create:
- $ git config –global user.name “Emma Paris” $ git config –global user.email “email@example.com”
- Optional: Install the Git Credential Helper on Windows. Bitbucket supports push and pull over from HTTP to your remote Git repositories on Bitbucket. Each time you interact with the remote repository, you must provide a username/password combination. You can store these credentials using Git Credential Manager for Windows instead of providing the combination each time.
Tools & functions
Git for Windows focuses on providing a lightweight, native set of tools that bring the full functionality of Git SCM to Windows while providing appropriate user interfaces for experienced Git users and novices.
- Git-BASH: Git for Windows provides BASH emulation for running Git from the command line. *NIX users should feel right at home, as the BASH emulation behaves the same as the “git” command in LINUX and UNIX environments.
- Git GUI: Because Windows users often expect graphical user interfaces, Git for Windows also offers Git GUI, a powerful alternative to Git BASH that provides a graphical version of almost every Git command-line function, as well as comprehensive visual diff tools.
- Shell integration: Simply right-click on a folder in Windows Explorer to access the BASH or GUI.