Git downloads, installation, configuration, code repository to create, submit <switch>

Git Download
link: http: //pan.baidu.com/s/1i5AYkYx Password: odnh
Git installed
Linux systems: Open a shell interface input: sudo APT-GET install git-Core
Windows systems: Double-click the downloaded installation point, click below has been step to complete the installation
using Git (using the command line)
installed on Windows Git can operate on a graphical interface, not introduced the operation of the graphical interface, introduced here only lines using Git command, command line operations master, graphics the interface is not a problem
to open interface
Linux system open shell, Windows system to find and open Git Bash at the start in
the configuration of your identity, this time to submit code system will know who submitted the command is as follows:
git config --global user.name "yourName" // note - and there is no space between the global
git config --global user.email "[email protected]"
For example, you named Sam
git config --global user.name "Sam"
git config --global user.email "[email protected]"
to check whether the configuration, enter:
git config --global user.name
git config --global user.email
若提示error :key does not contain a section: global

key does not contain a section: global

The error occurs is - between the global and the added space, can be removed
to create a code repository
repository (Repository) is a saved version of the management of local information you need, all local codes submitted will be submitted to the code repository, If you need to also be pushed to the remote repository
here to create a demonstration project, for example, I want to give ActivityTest project under my d drive to create a code repository, as follows
1. first enter the d drive, type cd d:, enter
2.cd the project path
3. enter git init

Create a code repository

Such code repository was built over, this time will generate a hidden .git folder in the root directory of the project, the folder is used to record all of the local Git operations, can be viewed (ls ls -al command by and - between spaces)

View the warehouse

If you want to delete the repository, delete the folder can be
submitted to the local code (add and commit commands)

add the code to be submitted to add in
commit to really do a commit
Add to add a single file, you can add an entire directory ,, can also add all the files

A single file: for example, git add AndroidManifest.xml
entire directory: git add src, for example,
all files: git add.
Submit

git commit -m "First commit."

If prompted git warning: LF will be replaced by CRLF | fatal: CRLF would be replaced by LF resolved in the following manner, if there is no problem, skip this warning solutions submitted directly

warning: LF will be replaced by CRLF

windows line breaks as CRLF, and line breaks in linux for LF, so prompt in performing add, solution:

Delete .git, and then disable the automatic conversion
$ RM -rf .git
$ git config --global core.autocrlf false
and then re-execute the
$ git the init
$ git the Add.

解决warning: LF will be replaced by CRLF

submit

git commit -m "First commit."

submit

Special instructions for Git line breaks check function (from http://blog.csdn.net/feng88724/article/details/11600375)
Git provides a newline check (core.safecrlf), you can check the file at the time of submission whether the mix of different styles of line breaks. This feature options are as follows:

false- without any check
warn- check and warn when submitting
true- check at the time of submission, if you refuse to submit to mix found

We recommend using the most stringent true option.
core.autocrlf (CRLF - Carriage-Return Line -Feed carriage return line feed)
If you're writing a program on Windows, or if you're working with other people, they are programming on Windows, but you have on other systems, in which case, you may encounter the line ending issues. This is because Windows uses a carriage return and line feed two characters to the end of the line, while Mac and Linux only use a newline character. Although this is a small problem, but it will greatly disrupt cross-platform collaboration.
Git automatically converts the line terminator CRLF to LF when you commit, and in the code checked out to convert LF CRLF. With core.autocrlf
to turn on this feature, if it is on a Windows system, set it to true, so that when code is checked out, LF is converted to CRLF:
$ git config --global core.autocrlf to true
Linux or Mac as the system uses LF line endings, so you do not want Git to automatically convert the files checked out; when a character line to end with a CRLF file was accidentally introduced you definitely want to amend the core.autocrlf set input in submitting to tell Git to convert CRLF to LF, not converted when you check out:
$ git config --global core.autocrlf the INPUT
it will sign on a Windows system file retention CRLF, will be on Mac and Linux systems, including warehouse reserved LF.
If you're a Windows programmer, and is developing a project run only on Windows, you can set false to cancel this function, the carriage returns recorded in the repository:
$ git config --global core.autocrlf false
---
Transfer: https: //www.jianshu.com/p/ea000d7bba0b
Author: VoguePaPa
link: https: //www.jianshu.com/p/ea000d7bba0b
Source: Jane book
Jane book copyright reserved by the authors, in any form reprint please contact the author are authorized and indicate the source.

Guess you like

Origin www.cnblogs.com/smartOnePunchMan/p/11280398.html