Objective
I have always wanted a piece of this stuff, because when I first contacted, I also carefully read the Liaoche tutorial, but it seems I think a little bit more, and will bring me a lot of redundant and repetitive operating burden, so I hope to compress it in my work cost, but search for a while did not find a satisfactory tutorial, A new year to comb your own experience.
Maybe the boys are more big God, think Git is so simple, it has been thought that the command line operation is so easy, and perhaps even despise the visualization to face the low-end users of the psychological, good, then you will be when I was parallel to the right corner.
I've always felt that something like git, he's just an incomplete tool for me, and I don't want to be an expert with him, something like that, Git today, maybe Gat tomorrow, or gay? So get a quick grasp of the important daily operations I need, preferably 10 minutes, that's fine, if you have a similar idea, okay, then don't talk nonsense, let's get started.
(Full-text limited to Windows systems.) )
What is Git?
Install Git and get a rough idea of what git is doing.
Permission check
First, your data is saved on a remote server, and the server needs to identify you. A section of RSA encrypted string.
Start GUI, menu-Help, "step1- Create key"Generate SSH Key
"step2-Add encryption Key" go to your code hosting server, in your account settings, adding it.
For example, the address in GitHub, the title is arbitrary, such as you can use Home,company and so on as the logo to distinguish.
Demos in the Gitlab
Account saving
If you do not set, each time you submit, you will be asked to fill in the password. So let's get this set up first.
"step3.1-Add environment variable "
My Computer-Properties-Advanced system settings-environment variables-new variable
Variable name HOME, variable value %USERPROFILE%
"step3.2-Create Account file "
Start - run Open%home%, which is the Windows Administrator account folder.
Create a new file named "_netrc", fill in the server address and account password you want to save.
Operation Flow
If you've ever used SVN, you'll get a general idea of how the process will work, if not.
Initialize (Git init)
As the name implies, it is a new project, just like you create a new canvas with PS. Right-click on your new folder to create it, and if you tap git bash it will go to the command line status as the current directory.
Add (Git Add)
Add not to commit code to a remote git library, git does not change your code it automatically helps you save every process you modify. You have modified a lot of files, but not all of the changes, and eventually intend to submit them, then what are you going to submit, you can add in the pending submission, called cache changes. Very simple, such as on the local computer I have the entire project complete, even contains the account password some files, but I just add in addition to the account password files, does not cache the account password file changes. It will not participate in subsequent operations without being add. Usually I cache all directly, it will automatically look for all the files that have changed, and do not need to submit the file in the ignored folder. (We'll talk about ignoring the following)
Ignore (. Gitignore)
But in fact most of our files are submitted together, do not go to the selection, or the like PSD, such as large source files and not as a product final display of the transition files, we can be unified in the temporary folder, and ignore this folder.
Commit (Git commit)
The commit indicates that the file that was added previously was confirmed to be committed to the GIT library. It is important to note that if you change the indentation of the code (although it is not modified), the default state is recognized as the entire code change. submission is required to write notes .
upload (Git push)
As the name implies, the upload is up to the remote server, the small partners can see our slag code (good shy.
Get Remote Code (Git remote/fetch)
For example, you are doing well in the company, sleepless tonight very excited, home ready to continue to move bricks, then we are in the home of the computer, ditto for a variety of installation configuration account, the company to do a good job of the east (but the company is not allowed, but if it is on GitHub is OK). Or if you develop something with a small partner, you have to fetch him first. As for how to operate, below. Now all you have to do is to know how to brush your teeth and look at your mouth and mouth to read the fetch is a ~
Come, read with me, fetch~~ (I'm afraid your brains won't make it.) )
To set up an association with a remote address, Git remote:
Fill in the SSH address and the project name. Here are 3 options:
First: Get the latest changes immediately (so you can do this if you are cloning a remote project locally).
Second: Create a new project locally, initialize the remote repository, and publish the past.
The third one: do nothing.
Get the latest changes to the repository while the project is in progress git fetch
Choose which branch from the remote repository gets the update, and if not, only the primary branch.
Note that the changes have been stored in the temporary area, you will need to merge, if there are no changes, the list is empty, such as:
Merge (Git merge)
Please note, regardless of your local code, after the fetch, is to merge, that is, after the fetch down, the big code is still in a small black room, we need to put it into our own pocket.
Select Merge-local merge and select local branch (only 1 master master if you did not create a branch)
Conflict Handling (Conflict)
The merging process may appear some red files with a bunch of exclamation marks, this time panic point what it does not work, do not worry, not the program is broken, but there are conflicting documents, such as a children's shoes written width:1180px, you wrote the Width:auto. So who are you going to use?
In the GUI interface body area, the body area right-click can be selected, use local version (using the native edition) or use remote version (using remotely), in the end with your or small partner? Or you can integrate it yourself.
There are also branches and some advanced features, if you need to know that you can explore again, the above operation has been able to meet the simple development needs.
Summarize
1. First installation, key addition, account and other one-time operation.
2. Operation Flow:
Do you think so easy, hurriedly have a try!
Git visualization very easy tutorial--git GUI how to use