This is a part of Git Tutorial Series.
In this page:
What is Git?
Git is a source control application. It is used to keep track of the source code change, and also facilitate source code distribution. See https://en.wikipedia.org/wiki/Git
It is a distributed version control system, which means,
- You keep the whole change history locally
- You can retrieve any version in the tree without accessing any server, and it is fast because the data are stored locally
- You can copy the whole change history to another server easily
Note: It is a bit complicated for Git LFS. See https://www.atlassian.com/git/tutorials/git-lfs
I use Git not just because it is common among developers, but also it is so easy to manage the change history using Git.
Let’s get your enviornment ready and start working with Git.
Environment Setup (Windows)
This section we will go through some software to use Git and their installation procedure. We are going to install,
- Git
- VSCode
- Git Graph
Even though there may be some Git tools to help you to do Git operations, it is highly recommended to learn the command line interface, which to give you the highest flexibility to manipulate the repository.
The installation guide below is Windows based and focuses on portable installation, because it can be very complicated to use installers in Windows system, which often requires admin right.
Git
Of course you need to install Git to use Git.
Installation
- Download the portable version here: https://git-scm.com/download/win
- Unzip to a folder for git. e.g.
C:\application\git
- Put the path to Git’s
\bin
into thePATH
environment variable - Type
git
in command line console to check whether it works
Configuration
- Run
git config --global core.editor "code -w"
to use VSCode (mentioned below) as the editor for Git - If you are behind corporate proxy, you may need to set up proxy like,
[http] proxy = "<proxy server:port>"
- If you need to access Git server with self-signed certificate or even no certificate at all, you may need to set like,
[http <server path>] sslVerify = false
Visual Studio Code (VSCode) and Git Graph
VSCode is a very powerful text editor. It support Git (with some basic functions) and Terminal inside, while Git Graph is a very powerful VSCode extension. With both of them, you can manage your code with Git easily.
Installation
- Download VSCode here: https://code.visualstudio.com/docs/editor/portable
- Unzip to a folder for VSCode. e.g.
C:\application\vscode
- Put the path to into the
PATH
environment variable - Type
code
in command line console to check whether it works - Go to
Extension
UI byView > Extension
or `Ctrl+Shift+X - Search for
Git Graph
- Click
Install
Now you are good to go for Git projects.