Windows build Git, TortoiseGit

1. Git Introduction:

  • Git is a distributed version control system open source, for quick and efficient handling of any small or large projects.
  • Git is Linus Torvalds To help manage Linux kernel development and the development of an open source version control software.
  • Git and commonly used version control tools CVS, Subversion and so different, it uses a distributed repository way, do not support server-side software.

Git and SVN difference

GIT is not just a version control system, it is also a content management system (CMS), work management systems. Git and SVN point of difference:

  • GIT is distributed, SVN is not: This is the GIT and other non-distributed version control systems such as SVN, CVS, etc., the core difference.
  • GIT contents by metadata stored, and SVN is by file: All resource control systems are the meta-information files hidden in a similar .svn, .cvs other folder.
  • GIT and SVN branch different branches: the branch that is not particularly in SVN, is another of a directory in the repository.
  • GIT is not a global version number, and SVN are: This is by far the largest GIT SVN compared with the lack of a feature.
  • GIT content integrity is superior to SVN: GIT content storage using the SHA-1 hash algorithm. This ensures the integrity of the content of the code, make sure to reduce damage to the repository in the event of disk failure and network problems.

2. Git installation:

download

Download: https://git-scm.com/downloads

installation

The first step: Double-click the downloaded installation package git, pop-up boxes, as shown below:

 

 

Step: click on "Next" to continue, and select the installation path, as shown below:

 

 

 

The third step: selecting an installation path, click on "Next" to continue, and the pop-up window installation configuration, including a command line git, git other graphics window, as shown below:

Additional icons Additional icons

  • On the desktop On the Desktop

Windows Explorer integration Windows Explorer right-click menu integration

  • ​Git Bash Here
  • GUI Go Here

Git LFS (Large File Support) Large File Support
Associate .git * configuration files with the default text editor will .git profile with default text editor is associated
to be run with Bash Bash associate .sh file to run Associate .sh files
use a TrueType font in all console windows in all the console window TrueType fonts
check daily for Git for Windows updates checked daily Git has Windows update
step four: the default configuration in accordance with the above, just click "Next" to enter the next step, pop "select start menu folder" window, as shown below:

 

 

Step Five: according to the default path, click on "the Next", the next step, into the "default selection for Git Editor" window, as shown below:

Use the Nano editor by default default Nano editor
Use Vim (The ubiquitous text editor) as Git's default editor to use Vim as Git default editor
Use Notepad ++ as Git's default editor to use Notepad ++ as Git default editor
Use Visual Studio Code as Git's default editor using the Visual Studio Code as Git default editor
use Visual Studio Code Insiders as Git's default editor using the Visual Studio Code Insiders as Git default editor
step Six: click "Next", enter the next step, enter the "adjustment Path environment variables "window, as shown below:

Configuring the PATH environment
the Use Git Git Bash only from
This IS at The Safest Choice your PATH AS Modified by Will not BE BE AT all.You by Will only of Able to use the Command Line Tools form at The Git Git Bash.
This is the safest choice, because your PATH will not be modified. You can only use the Git Git Bash command-line tool.

The Use Git from at The Windows the Command Prompt
This the Option IS Considered Safe AS IT only ADDS some minimal Git Wrappers to your the PATH to Avoid cluttering your Environment with optional Unix Tools. By You by Will BE of Able to use Git from both-Git Bash and at The Windows the Command Prompt.
this option is considered to be safe because it only added to some of the smallest package Git PATH, in order to avoid confusion with the optional tool for Unix environments. You will be able to use Git Git Bash and from the Windows command prompt.

Use Git and optional Unix tools from the Windows Command Prompt
from the Windows command prompt using Git and optional Unix tools
Both Git and at The optional Unix Tools by Will you BE added to the PATH
Git and optional Unix tools will be added to your computer of the PATH
warning: this will override Windows tools like "find and sort" .Only use this option if you understand the implications.
warning: this will cover Windows tools, such as "find and sort". Only use this option only after understanding its meaning.
Seventh Step: The second option, then click on "Next" to continue, and the rear end transmission HTTPS is selected, as shown below:

 

 

Use the OpenSSL library
OpenSSL libraries
Server certificates will be validated using the ca -bundle.crt file.
Server certificate will use ca-bundle.crt file for verification.

Use the native Windows Secure Channel library
using a local Windows Secure Channel Library
Server certificates will be validated using Windows Certificate Stores.This option also allows you to use your company's internal Root CA certificates distributed eg via Active Directory Domain Services.
Server certificates will use the Windows certificate storage verification. This option also allows you to use the company's internal root CA certificate, for example, through Active Directory Domain Services.
Eighth Step: Select "Use the OpenSSL library", click on "Next" the next step, the line terminator configuration, as shown below:

Windows-style Checkout, the commit-style Unix Line Endings
Git by Will Convert For LF to CRLF OUT Checking the when text files.When Committing. As a text Files, by Will BE Converted to LF CRLF .For Cross-pltform the Projects, the this IS ON Windows at The Recommended Setting ( " core.autocrlf "is set to" true " )
when checking a text file, Git will convert LF to CRLF. When submitting a text file, CRLF is converted to LF. For cross-platform project, which is recommended on Windows settings ( "core.autocrlf" is set to "true")

Checkout AS-IS, the commit Unix-style Line Endings
Git by Will not the perform the any Conversion the when Checking OUT text Files. The When Committing. As a text Files, CRLF by Will BE Converted to LF. The For Cross-Platform the Projects, the this IS at The Recommended Setting ON Unix ( " core.autocrlf "is set to" input " )
when checking a text file, Git does not perform any conversion. When submitting a text file, CRLF is converted to LF. For cross-platform project, which is the recommended setting on Unix ( "core.autocrlf" is set to "input")

AS-IS Checkout, the commit AS-IS
Git by Will not the when the perform the any Conversions Checking OUT or Committing. As a text files.Choosing the this IS not the Option Recommended for Cross-Platform the Projects ( "core.autocrlf" IS the SET to "false")
in detection or when submitting a text file, Git does not perform any conversion. For cross-platform project, this option is not recommended ( "core.autocrlf" is set to "false")
Step 9: select the first item, click on "Next" the next step, the terminal emulator configuration, as shown below:

The Use MinTTY (The default Terminal of MSYS2)
the Git the Bash Will use MinTTY AS Terminal Emulator, Which Sports A resizable window, non-Rectangular Selections and A the Unicode font. The Windows Console Programs (SUCH AS Interactive the Python) MUST BE Launched Via 'winpty' to in MinTTY Work.
the Git MinTTY be used as the Bash terminal emulator, the emulator has a resizable window, and the non-rectangular selection Unicode font. Windows console program (such as interactive Python) must 'winpty' start to run in MinTTY by.

The Windows the Use 'Console window default
the Git The default Console window Will use of the Windows ( "cmd.exe"), the Win32 Which Works Well with the Python Console Interactive Programs or Node.js SUCH AS, A Very Limited has But default Scroll-Back, Needs bE the Configured to use aUnicode to font in the Order to Run the display correctly & non-ASCII characters, and Prior, the ITS to Windows 10 and Windows IT WAS not only allowed Freely resizable text Rectangular Selections.
Git will use the default Windows console window ( "cmd.exe "), this window can be used with Win32 console program (such as interactive Python or node.js) together, but the default rollback is very limited, need to be configured to use unicode font to display non-ASCII characters correctly, and before Windows 10 which can freely adjust the window size, and only text selection rectangle.

Step 10: Select the first item, just click "Next" to continue, and additional configuration options, as shown below:

Enable file system caching
enabled file system caching
File system data will be read in bulk and cached in memory for certain operations ( "core.fscache" is set to "true"). This provides a significant performance boost.
File system data will be bulk read and cached for certain operations ( "core.fscache" is set to "true") in the memory. This provides a significant performance boost.

Enable Git Credential Manager
to enable Credential Manager Git
The Git Credential Manager for Windows provides secure Git credential storage for Windows, most notably multi-factor authentication support for Visual Studio Team Services and GitHub. (Requires .NET framework v4.5.1 or or later) .
Windows of Git for Windows credential Manager provides secure storage Git credentials, most notably multi-factor Visual Studio Team Services and GitHub authentication support. (Requires .NET Framework v4.5.1 or later).

Enable symbolic links
Enable symbolic links
Enable symbolic links (requires the SeCreateSymbolicLink permission ) .Please note that existing repositories are unaffected by this setting.
Enable symbolic link (requires SeCreateSymbolicLink rights). Please note that the impact of existing repositories independently of this setting.

Tenth step: the default configuration, click on "Install" to start the installation, as shown below:

 

 

Step 12: Installation complete

 

 

Thirteenth Step: You can test whether the cmd inside Path, enter the installation was successful or git --version git try in the CMD.

3.Git workflow:

The general workflow is as follows:

  • Git clone resources as a working directory.
  • Add or modify files on resources clones.
  • If someone else changed, you can update the resource.
  • Check changes before submission.
  • Submitted.
  • After modifications are complete, if an error is found, you can withdraw and submit revised and submitted again.

 

4.Git workspace, suspend the zone and in the repository

We first understand under Git workspace, the repository concept and staging area

  • Workspace: that you can see in the computer catalog.
  • Temporary Area: English called stage, or index. Generally stored in  .git index file in the directory  (.git/index) in, so we put the staging area is sometimes called the index  (index.
  • Repository: Workspace has a hidden directory .git, this is not the work area, but Git repository.

 

5. Git Basic Operation

Get in touch with a command to create a project

git init

Create a new directory in the Git repository with git init. You can do this in any directory at any time, completely localized.

git init

git clone

Use git clone a copy to a local Git repository, so that they can view the item, or be modified.

git clone [url]

Basic Snapshot

git add

git add command to add the file to cache

git add <filename>

git status

git status to see if you have modified since the last commit.

git status
git status -s

git diff

Details of the results of the implementation of git diff git status to see the execution.

git diff command displays the write cache and write cache but has not yet distinguish changes has been modified. git diff There are two main scenarios.

  • Yet caching changes: git diff
  • View cached changes: git diff --cached
  • View cached and non-cached all changes: git diff HEAD
  • Displays a summary rather than the entire diff: git diff --stat

git commit

Use git add commands to the snapshot of the content you want to write buffer, and execute git commit will add content to the buffer warehouse.

Git you have to submit a record of every your name and e-mail address, so the first step you need to configure a user name and e-mail address.

git config --global user.name 'yourname'
git config --global user.email youremail

The files are written to the cache area and submit comments

git commit -m 'update message'

git reset HEAD

git reset HEAD command to remove the cached content.

git reset HEAD -- <filename>

Pull and push

git pull

git pull command is used to obtain branching from another repository or a local and integrated (integration). Git pull command role is: to retrieve a branch of updating the remote host, and then merged with the specified local branch, its complete format a little bit complicated.

git pull <远程主机名> <远程分支名>:<本地分支名>

The remote repository changes into the current branch. In the default mode, git pullit is git fetchfollowed by the git merge FETCH_HEADabbreviation. More specifically, git pullusing the given operating parameters git fetch, and invokes git mergethe retrieved header into the current branches branch.

git push

git pushCommand is used to update the local branch, pushed to the remote host. Its format git pullcommand similar.

git push <远程主机名> <本地分支名>:<远程分支名>

 

6. Git tag

If you reach an important stage, and hope to always remember that special submit a snapshot, you can use  git tag to give it to tag.

For example, we want to release our mall project a "1.0.0" version. We can use  git tag -a v1.0.0 a command to commit marked the latest (HEAD) "v1.0.0" label.

-a Option is meant to "create a label annotated" is. -A option can not be executed, but it does not record this label is Shashi Hou to play, who to play, will not let you annotate a label. I recommend creating labels have been annotated.

git tag -a v1.0.0

If we want to see all the tags can use the following command:

git tag

7. TortoiseGit simplify operation


TortoiseGit, Chinese name Git turtles. Turtle Git supports only Windows systems, there is a senior turtle SVN, TortoiseSVN and TortoiseGit are very good open source repository client. Divided into 32-bit and 64-bit version. And supports a variety of languages including Simplified Chinese

download

Download: https://download.tortoisegit.org/tgit/

 

Installation Package: TortoiseGit-2.6.0.0-64bit.msi

Chinese localization package: TortoiseGit-LanguagePack-2.6.0.0-64bit-zh_CN.msi

installation

We need to install the package, then install the language packs (LanguagePack). Because TortoiseGit just a program shell, must rely on a Git Core, which is the one we installed the Git. So make sure before installation has been operating on a completed the following 64-bit version of the demo (except 64, 32-bit file name is not the same, other operations are the same)

Step: Double-TortoiseGit installation package, as shown:

 

 

Step two: Click Next, enter the next copyright information interface, as shown:

 

 

Step 3: Click Next, enter the next step, as shown:

 

 

Step 4: Select installation path, then click Next, enter the next step, as shown:

 

 

Step Five: Click Install, to start the installation, as shown:

 

 

Step Six: Wait installation, the installation is complete as shown:

 

 

Step Seven: After installation is complete, click the right mouse button, you will find TortoiseGit in the right-click menu in any blank space on the desktop, as shown:

 

 

Eighth step: selecting Settings, as shown:

 

 

We can see that in the right language which is only in English, not Chinese. Next we install the Simplified Chinese language pack 

Install a language pack

The first step: Double-click to open the Language Pack Installer

Step two: Click Next, enter the next step, as shown:

 

 

The third step: waiting for installation, the installation is complete as shown:

 

Step 4: Enter the TortoiseGit setting interface, select Simplified Chinese language in which the right, then click Apply, OK, finished to complete, as shown:

 

Check the check box does not automatically upgrade, you may also need to specify the path to the file Git.exe

Step Five: Click the right mouse button again, you can see the pop-up menu has become a Chinese original Settings become set; Clone become clones.

 

Guess you like

Origin www.cnblogs.com/chuanqi1995/p/11445371.html