Introduction to git
Git is the most advanced distributed version control system in the world, and SVN is a centralized version controller. In fact, Git has its own centralized version library or server like SVN, but Git is more inclined to be used in distributed mode. , that is, after each developer checks out the code from the central repository/server, he will clone a local repository that is exactly the same as the central repository on his own machine. In git, you can also create different branches for the same project, because Git just saves the changes , each branch is equivalent to a pointer, and the current version is pointed to by the HEAD pointer, so no matter one file or 10,000 files, git creates branches at the same speed.
Install Git
Install on Linux
If you happen to use Debian or Ubuntu Linux, sudo apt-get install git
you can install Git directly in one step, very simple。
sudo apt-get install git
Install on Mac
Mac installation Install Xcode directly from the AppStore. Xcode integrates Git, but it is not installed by default. You need to run Xcode, select the menu "Xcode" -> "Preferences", find "Downloads" in the pop-up window, and select "Command Line Tools", Click "Install" to complete the installation.
Install on Windows
To use Git on Windows, you can download the installer directly from the Git official website , and then install it according to the default options.
After the installation is complete, find "Git" -> "Git Bash" in the start menu, and a similar command line window pops up, indicating that the Git installation is successful!
Welcome interface : go directly to the next step;
Agreement : must be accepted;
Installation location : Reserve 100M space, customize the installation location;
Select installation components : can also be selected by default ;
--Addition icons : Choose whether to create a quick launch bar icon or whether to create a desktop shortcut;
--Desktop browsing (Windows Explorer integration) : The method of browsing the source code, the separate context browsing only uses bash or only the Git GUI tool; the advanced context browsing method uses the git-cheetah plugin plugin;
--Associated configuration file : whether to associate the git configuration file, the configuration file mainly displays the style of the text editor;
--Associate shell script files : whether to associate script files executed by the Bash command line;
--Use TrueType encoding : whether to use TruthType encoding in the command line, which is a common encoding developed by Microsoft and Apple;
Start menu shortcut directory : set the directory name of the shortcut in the start menu, you can also choose not to create a shortcut in the start menu ;
Set environment variables : choose which command line tool to use, in general, we can use Git Bash by default, which is selected by default ;
-- Git built - in: use the Git Bash command-line tool that comes with Git;
--The system comes with CMD : use the command line tool of the Windows system;
--Both : Both of the above are configured at the same time, but note that this will overwrite the find.exe and sort.exe tools in Windows. If you don't understand these, try not to choose;
Choose a newline format :
--Check out the conversion of windows format to unix format : Convert the line break in windows format to the line break in unix format before submitting;
--Check out the original format and convert it to unix format : no matter what format, it will be converted to a newline in unix format before submitting;
--No format conversion : no conversion, what is checked out, what is submitted;
start installation:
end of installation: over;
The above windows installation is reproduced in https://blog.csdn.net/liuwengai/article/details/52072344
After installation, find Git Bash and run the Git client
Configure Git variables
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
The name and email address are used to identify Git on this machine.
Pay attention git config
to the parameters of the command. --global
If you use this parameter, it means that all Git repositories on your machine will use this configuration. Of course, you can also specify different user names and email addresses for a certain repository. Of course, you can also use global variables. Different names and emails can be configured in the warehouse. You can see the conf file in the .git folder. If you don't use it globally, the conf will record the name and email of the warehouse.