1. GitHub operation
This section first briefly describes the use and operation of Git, and then introduces the use and operation of Tortoisegit.
Look at the SVN operation first, the most common is checkout (check out ...), updates (update ...), and commit (commit ...); Equivalent to having a server-side that can be accessed and manipulated by multiple clients.
Git is the next generation of SVN's version control System/protocol. Suitable for large-scale open source software multi-person collaboration development. There is a general repository (such as Github,csdn,oschina, etc.), each client has a local repository (this local repository is a bit of an SVN service-side warehouse), and a visible local project.
Let's think about at least what we need to do. Take GitHub for example, first, you have to have an online warehouse (Repository), which starts with a new warehouse.
to create a warehouse, you must first register your account. Please refer to: Create a GitHub technology blog all about: http://blog.csdn.net/renfufei/article/details/37725057
then, sign in to GitHub, find the new Repository or plus drop-down button (+) in the upper-right corner and click on the Enter new warehouse page: https://github.com/new as shown in the following:
After filling in the warehouse name and other information, click the "Create Repository" button to create an online repository. Because this warehouse is attached to your account, it can be any legal character, as long as it does not conflict with your other warehouses.
Once the warehouse has been created successfully, it will go to the Warehouse preview page, as shown in:
Then, we can click on the right side of the HTTPS link, the above text box shows the HTTPS protocol under the warehouse access address, you can click to select All, or click the Copy button on the right to copy to the Clipboard. For example, the project access path that you just created is:
https://github.com/cncounter/LispGentleIntro.git
is a URL that starts with https://and ends in. git, which, according to the prompts, is called the clone URL.
OK, the warehouse is created and you can go to the next step. Git usage and operation
2. Git usage and operation
If you prefer the command line, you can refer to this section briefly. Otherwise, please scroll down and look directly at the Tortoisegit use and operation
2.1 Cloning Project (Clone ...)
Win+r shortcut key to open the Run dialog, enter cmd
, in cmd (in fact, in Gitbash), the CD switch to the directory that holds the GIT project, such as:
Then execute the command: git clone https://github.com/cncounter/LispGentleIntro.git
the project will be cloned into the current directory, the project's directory name defaults to Lispgentleintro.
The command line is as follows:
2.2 Submit project (Commit ...)
You can then cd
switch to the Lispgentleintro directory to add or modify some files. This is just a mock operation. The actual situation may be to import the project using Eclipse (do not copy, copy ...) Make some edits and then tell the index library all the changed files in the current directory, and then submit them to the local repository.
What are the benefits of submitting to a local warehouse? The local repository is a version management library, we write code, if it is wrong, then we may need CTRL + Z to undo, undo undo, if a lot, and cross files, it is troublesome, may need to copy files or something. This is where the local repository can be useful. Modify to a stage, and then commit to the local warehouse. Can effectively prevent loss, convenient fallback. Also, submitting to the local repository does not affect what others see (only native visible).
2.3 Push project (push ...)
If this is done to a certain extent, it can be pushed to the remote online repository. Before pushing, make sure that you have set the global user.name
and user.email
, if not set, or do not want to use global information, can be set under the current project:
You can then push and push to push the portion of the content that has been submitted to the local repository to the remote online repository. (the part that has been modified but not submitted will not be pushed). Execute the git push
command:
After connecting to the remote server, you will be asked to enter a user name and password. Where the username is your account when you register for GitHub, not the mailbox. Then the password, note that the password is not echoed, that is, for security, do not tell you the specific input of a few characters, enter the completion of the return. As follows:
OK, push to complete, this time with the browser to open the online warehouse, to see if the content has changed?
2.4 Fetching items (pull ...)
Of course, if more than one person works together, or if multiple clients make changes, then we'll also pull ... Other people push the content down to the online repository. The great gods are not recommended for pull commands because they encapsulate the details (git pull = = git fetch + git merge). For this group of gods who prefer the command line, it is a compulsive disorder in control!!! (Open a joke, in fact, the project members are complex, the agreement is not good after, pull does have a lot of problems, will deceptive.)
For general use, we git pull
can do this:
Of course, since no other files have been modified, the direct prompt has been updated to the latest. General operations that's all, and it's important to note that, as with the good habits of SVN, you might want to pull the local content before you modify it to reduce the likelihood of conflict.
3.TortoiseGit Use and operation
Using git commands is sometimes really inconvenient, especially if you have to enter a password every time, and if you configure SSH, it's really cumbersome. (Of course, you have to use the Windows artifact to have a friendly client-side graphical interface!!!)
Please refer to the previous section for installation of Tortoisegit.
3.1 Cloning a project
Open Explorer (My Computer/computer), go to a well-planned directory, then right-click in the blank, select Tortoisegit---Clone ... (Clone ...).
The Clone Project dialog box pops up:
Enter the project address in the URL of the dialog box, such as:
https://github.com/cncounter/LispGentleIntro.git
Determine the local directory and click the OK button. After the wait is complete, click the Close button.
3.2 Modifying submitted items
After the project cloning is complete (you can understand clone cloning as a download, check out the checkout operation). Modify some of the files in the local project, as you would README.md
modify them to read as follows:
- Lispgentleintro
- ===============
- lisp-Symbol Calculation Primer translation
- <a href= "http://cncounter.duapp.com/" > Celestial counters </a>
You can also try adding some files. such as files.txt
.
Then right-click in the blank area of the local project and choose Tortoisegit---Submit (C), "Master" ... Or: Commit, "Master" ....
The Commit dialog box pops up:
As a good habit, fill in the submission log, tick the file that needs to be submitted, and then click the "OK" button to submit to the local repository.
3.3 Push the project submitted to the local to the online warehouse
Push is the next step in the commit.
Right-click in the blank area of the local project and choose Tortoisegit---push ... Or: Push ....
Pop-up Push dialog box:
Generally keep the default, click the "OK" button.
Then the push progress screen pops up and you may be asked to enter your user name:
OK, then ask for the password:
After the password is entered correctly, OK, display the push successful interface:
If you follow the settings in the previous section, the password will be remembered after you enter the password. The password is stored in C:\Users\Administrator\.git-credentials
this file in clear text, please use it carefully.
3.4 Fetching items (pull ...)
If the local project does not have a new online repository, then a pull operation is required (fetch ...).
Right-click in the blank area of the local project and select Tortoisegit ... Or: Pull ....
Pop-up Pull dialog box:
If the pull has a bug, you can tick on the variable base (do not make an error check the!!!), OK, enter the pull Progress interface:
Then perform the variable base:
And then you're done.
This should be a tortoisegit bug, to solve this problem, please refer to solve the tortoisegit strange bad file number problem (or you can change back to the old version.) If you do not have this problem, it may be that my machine is damaged.
Git and tortoisegit basic operations