combing1のブログ -22ページ目

combing1のブログ

ブログの説明を入力します。

Origin has always wanted to publish the project on GitHub, involved in the project, but more difficult to learn Git this cargo ah. 2015 Nike Free 5.0 I bought a 'Git Definitive Guide', turned a few pages, the mother, and what a complex, but also is Cygwin command line, scared I can not learn. Finally one day find GitHub also has a Windows client, tried it quite easy to use. Git does not need to know anything about the principles and commands, you can also slip hemp construction project on GitHub, and is very happy. But it did not last long, for the first time to participate in open source projects to make a fool of. After carefully Fork of Pu Ling greatly (JacksonTian) of EventProxy project, submitted by local changing for the better, synchronized to the server, excited to emit Pull Request ...... then found the problem. I find updates diff chart shows not just that I modified a few lines, but the entire file is shown as modified. (The picture shows a schematic diagram) This seems very strange ah, then quickly withdraw Pull Request, focusing instead on their own to find a cause. Preliminary locate the file in question is a newline, because I 579756 403 Purple White Nike Black Mamba 24 Kobe Sale found a local file that Windows line breaks, but it is clear that we are doing the project are using UNIX newline ah. This is a major doubt, so in the repeated comparison Web client and Nike Free Run 3 local individual files, after the various versions, the basic orientation to the problem. Background Under each operating system, line breaks text file that is used is not the same. UNIX / Linux using 0x0A (LF), the early use of the Mac OS is 0x0D Air Max 2011 Womens Purple Grey (CR), and later of OS X after replacing the kernel is consistent with UNIX. But DOS / Windows have been using 0x0D0A (CRLF) line breaks. (I do not know how you think Bill Gates, two-way compatible?) This is not Air Max 2012 Black Navy Blue White really a unified cross-platform file exchange trouble. Although reliable text editor and IDE support these types of line breaks, but when you save the file there must be a fixed standard ah, such as cross-platform collaborative project source code, in the end is what kind of style newline save it? Git as a source code version control system, in a (I look) a little pre-empt, wiseacre attitude on this issue provides a 'solution.' Git Linus developed by the famous, initially only runs on * nix systems, it is recommended that only the UNIX-style line breaks to save storage. But it also takes into account the cross-platform collaboration scenarios, and provides a 'newline automatic conversion' feature. This feature is by default in 'automatic mode', when you check out a file, it tries to UNIX line breaks (LF) Replace Windows newline (CRLF); When you submit the file, it tries to replace the CRLF LF. (See to understand it? A version control system will modify in case you unknowingly your files. This TM is simply cool, right?) Defect Git's 'line breaks automatic conversion' feature sounds very smart , very intimate, because on one hand it tries to maintain consistency within the depot file (UNIX style), on the one hand and to ensure compatibility of the local file (Windows style). Unfortunately, this feature is a bug, and are less likely to be fixed Nike Free Run 3 Women in the short term. Problem specifically in, if you hand this file is a file that contains UTF-8 Chinese characters, then the 'newline automatic conversion' feature is not working at the time of submission (but conversion process to check out when there is no problem). I guess Nike Lebron 10.8 maybe this function module directly in dealing with the collapse of returned Chinese characters + CRLF this combination. This may not be the only trigger a scene (after all, I do not have much energy to accompany it to play), but just this one pit would have been sufficient. Stepped pit This is a pretty big hole, Chinese developers under Windows almost always caught. For example, you are in the default state New Nike Free 5.0 V4 Grey Blue Running Shoes of 597806-400 Nike LeBron X EXT QS Denim-Pink Outlet Windows with Git to check out a file, write a line of Chinese Notes (or the file originally contained Chinese), and then save the file submitted ...... inadvertently, your file will be destroyed. Because you submit a file to the warehouse has been completely turned into a Windows-style (when you check out of the UNIX-style Windows style but turned into submission and did not convert), each line has changed (see the beginning of this article diagram), and this modification not visible (most diff tool is difficult to clearly show the newline), which eventually leads to you who can not see what has changed in the end this submission. This was not enough. If other small partners discovered the problem, change the line breaks the sound mind to come back, and then you repeat the tragedy of the above again, then edit the file history essentially Air Jordan Outlet becomes a mystery of. Because foreigners is almost impossible to step on the pit, so this bug has been hidden to exist. But casual search on the Internet, you will find more than me is definitely the victim, such as the big brother of the encounter would be much better than I bitter. Prevention New Nike Free 5.0 V4 Grey Lime Trainers First, do not rush to the entire Git, first whole yourself. Your team needs to determine a uniform standard newline (recommended UNIX style). Then, team members need to prepare separately - Configure their own code editor and IDE, achieve these two requirements: default newline team uniform standard in the new file to maintain the existing line breaks when opening files character formatting intact (do not do automatic conversion) so that one can ensure the specification maximum extent consistent with the project code, on the other hand, even if some of the existing legacy code does not regulate the situation, it will not lead to confusion because of repeated conversion. (Of course, as an obsessive-compulsive disorder, I wish all of the project from the outset into the rigorous and orderly path.) Next, we can begin to tune Git up. My suggestion is totally turn this wiseacre 'newline automatic conversion' feature. After closing, Git you would not have to do any hands and feet of line breaks, you can completely autonomously, can be expected to control their own style line breaks. The following main Git for different clients, were introduced about operation methods. Git for Windows that the goods produced by the official Git, the installation will be to sell you 'line breaks automatic conversion' function, it is estimated that most people watching gorgeous features will not hesitate to choose the first item after the introduction (automatic conversion). Please do resist the temptation, select the last item (without any hands and feet). If you have made a wrong choice, you do not need to reinstall, you can use the command line to directly modify the settings. Very simple, this cargo comes directly open command-line tool Git Bash, enter the following command, then hit Enter to: git config --global core.autocrlf falseTortoiseGit Air Max 2011 Womens Grey Green many students came from TortoiseSVN are likely to choose as the main TortoiseGit client, then you need to set it. In the Windows Explorer window, right click and select 'TortoiseGit → Settings → Git', make the following settings. (Because TortoiseGit is actually based on a Git for Windows GUI shell, you set in the previous section did affect the state of these options on the map, they may direct that you need the same again.) GitHub for Windows Client It is the end of today's second defendant. This stock is very easy to use, very suitable for white, I mainly use it to clone a key project to the local. Perhaps it simple and easy to maintain cordial image, which provide goods and not as rich options like TortoiseGit (for 'line breaks are automatically converted' fully Air Jordan Heel functional details such secrecy ah, me dead do not know how white dead……). Therefore, we need to manually modify its configuration. GitHub for Windows client is actually a shell, it Nike Air Max comes with a portable version of Git for Windows. This portable version and install your own Git for Windows are independent, but they all use the same configuration file (the file is actually .gitconfig current user's home directory). So if you have configured your own install Git for Windows, it would not have anything to worry about. But if your machine just installed over GitHub for Windows client, then the easiest way is to manually modify configuration configuration files. Git modify global configuration file into the current user's home directory (usually XP user directory is C: \\ Documents and Settings \\ yourname, in Vista and Win7 under the C: \\ Users \\ yourname), with your most comfortable text editor Open .gitconfig file. In the [core] section to find autocrlf, will change its value to false. If not found, it added in [core] section line :( final results shown in Figure) autocrlf = false in fact all of the commands described above rows or to configure a graphical interface, the final results are the same, because the nature of the We are modifying the configuration file. Git also turn off the 'newline automatic conversion' function is enough? Lost its 'protection', you would feel a little at ease. You might ask: If I accidentally mixed in the Nike Free 5.0 V2 Women document several Windows Enter the how to do? Such accidents can prevent it? Indeed Git really help you stop this mistake. It provides a newline check (core.safecrlf), you can check whether a file when submitting a mix of different styles of line breaks. This option functions as follows: false - do not do any checking warn - Check and warning true at the time of submission - checking when submitting, if found mixed refused to submit I suggest using the most stringent true option. And core.autocrlf, as you can through the command line, GUI, configuration files three ways to modify this option. Specific operations will not go into, we all learn by analogy it. Finally, you may also ask, if my editor accidentally newline entire file is converted to another format how to do? But also to prevent it? This ...... I really can not help you. So it is recommended that you file more carefully before submitting the file status: If you find the number of rows to change too much, and the same increase or decrease the number of lines, we must guard against is not out of the accident situation. Graphical interface spoiled children often lack patience, turning a blind eye to the system information, see the button on the point, easy for small negligence led to a big accident. So experts who favor command line, not without reason. Well, the small partners, today's 'stepped pit Adventures' on here, our next set-bye! I wish you all Happy coding!GitHub first pit: newline automatic conversion