In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is about the basic operation of Git and TortoiseGit. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. GitHub operation
Let's take a look at the operation of SVN. The most common ones are check-out (Check out...), update (Update...), and submit (Commit...); it is equivalent to having a server side that can be accessed and operated by multiple clients.
Git is a new generation of version control system / protocol after SVN. Suitable for large-scale open source software multi-person collaborative development. There is a master repository (such as GitHub,CSDN,OSchina, etc.), each client has a local repository (this local repository corresponds somewhat to SVN's server warehouse), and a local project that can be seen.
Let's think about at least what functions we need to have. Take GitHub as an example, first of all, there must be an online warehouse (Repository), which must first build a new warehouse.
To create a warehouse, you must first register an account. Please refer to: create GitHub technology blog introduction: http://blog.csdn.net/renfufei/article/details/37725057
Then, log in to GitHub, find New Repository or the plus sign drop-down button (+) in the upper right corner, and click to enter the new warehouse page: https://github.com/new, is shown below:
After filling in the warehouse name and other information, click the "Create repository" button to create an online warehouse. Because this warehouse is hung under your account, it can be any legal character, as long as it does not conflict with your other warehouses.
After the warehouse is successfully created, you will go to the warehouse preview page, as shown below:
Then, we can click the HTTPS link on the right, and the top text box shows the warehouse access address under the HTTPS agreement. You can click to select all, or you can click the copy button on the right to copy to the clipboard. For example, the project access path you just created is:
Https://github.com/cncounter/LispGentleIntro.git
It's a URL that starts with https:// and ends with .git, and, according to the hint, is called clone URL.
All right, the warehouse has been created and you can move on to the next step.
2. Use and operation of Git
If you prefer the command line, you can simply refer to this section. Otherwise, please turn down and look directly at the use and operation of TortoiseGit
2.1Clone Project (clone...)
The Win+R shortcut opens the run dialog box, and enter cmd to enter. In cmd (actually, it is also possible in GitBash), cd changes to the directory where the git project is stored, such as:
Microsoft Windows [version 6.1.7601] copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\ Users\ Administrator > FRV F:\ > cd GIT_ALL
Then execute the command: git clone https://github.com/cncounter/LispGentleIntro.git, and the project will be cloned to the current directory, and the directory name of the project defaults to LispGentleIntro.
F:\ GIT_ALL > git clone https://github.com/cncounter/LispGentleIntro.gitCloning into 'LispGentleIntro'...remote: Counting objects: 5, done.remote: Compressing objects: 100% (4 delta 4), done.remote: Total 5 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (5 Total 5), done.Checking connectivity... Done.
The command line screenshot is as follows:
2.2 submit the project (commit...)
Then you can cd to change to the LispGentleIntro directory, add or modify some files. This is just a simulation of the operation. The actual situation may be to import the project using Eclipse (do not copy, Copy...) Make some edits, then tell the index database all the changed files in the current directory, and then submit them to the local warehouse.
F:\ GIT_ALL > cd LispGentleIntroF:\ GIT_ALL\ LispGentleIntro > echo some content > > cncounter.txtF:\ GIT_ALL\ LispGentleIntro > echo by cncounter > > README.mdF:\ GIT_ALL\ LispGentleIntro > git add. F:\ GIT_ALL\ LispGentleIntro > git commit-m "add some info." [master 86d090f] add some info. 2 files changed, 4 insertions (+) create mode 100644 cncounter.txt
What are the benefits of submitting it to the local warehouse? Local repository is a version management library, when we write code, if we write wrong, then we may need Ctrl+Z to undo, undo, if many, and cross-file, it is very troublesome, may need Copy files and so on. At this time, the local warehouse is very useful. Modify it to a certain stage and then submit it to the local warehouse. It can effectively prevent loss and facilitate fallback. Also, submitting to the local warehouse will not affect what others see (only visible locally).
2.3 push project (push...)
If it is completed to a certain extent, it can be pushed to a remote online warehouse. Before pushing, make sure that you have set global user.name and user.email. If it is not set, or you do not want to use global information, you can set it under the current project:
F:\ GIT_ALL\ LispGentleIntro > git config user.name "renfufei" F:\ GIT_ALL\ LispGentleIntro > git config user.email "renfufei@qq.com"
Next, you can perform a push, which pushes the content that has been submitted to the local warehouse to the remote online warehouse. The part that has been modified but has not been submitted will not be pushed. Simply execute the git push command:
F:\ GIT_ALL\ LispGentleIntro > git pushUsername for 'https://github.com': renfufeiPassword for' https://renfufei@github.com':Counting objects: 6, done.Delta compression using up to 8 threads.Compressing objects: 100,100,402 bytes | 0 bytes/s, done.Total 4 (delta 1), reused 0 (delta 0) To https://github.com/cncounter/LispGentleIntro.git e8c0fb1..6407079 master-> master
After connecting to the remote server, you will be asked to enter your user name and password. Among them, the user name is the account you registered for GitHub, not your email address. Then there is the password, note that the password is not echoed, that is, for security, do not tell you how many characters you entered, enter and enter. The screenshot is as follows:
All right, the push is complete, then open the online warehouse with a browser to see if the content has changed?
2.4 pull items (pull...)
Of course, if multiple people collaborate, or if multiple clients make changes, then we also need to pull (Pull...) the content that others pushed to the online warehouse. The great gods do not recommend using the pull command to pull, because it encapsulates the details (git pull = = git fetch + git merge). For this group of gods who prefer to use the command line, everything under control is an obsessive-compulsive disorder! Just kidding, in fact, the project members are complicated. After a bad agreement, pull does have a lot of problems and will trick people.
For regular use, we can simply execute git pull:
F:\ GIT_ALL\ LispGentleIntro > git pullAlready up-to-date.
Of course, since no other files have been modified, a direct prompt has been updated to the latest. That's all for routine operations. It's important to note that, like the good habit of using SVN, you'd better pull before you modify local content to reduce the possibility of conflicts.
3. Use and operation of TortoiseGit
Sometimes it's not convenient to use the Git command, especially if you have to enter a password every time, and it's really troublesome to configure SSH. (of course, you must use the Windows artifact to have a convenient and friendly client graphical interface!)
For the installation of TortoiseGit, please refer to the previous section.
3.1 Clone Project
Open Explorer (my computer / computer), enter a planned directory, then right-click in the space and 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 waiting for completion, click the close button.
3.2 modify the submitted project
After the project is cloned (the clone clone can be understood as downloading and checking out the checkout operation). Modify some files in the local project, such as changing README.md to the following:
Introduction to LispGentleIntro=Lisp- symbol Computing Guide for translating Chinese counters
You can also try to add some files. Such as files.txt.
Then right-click in the space of the local project and select TortoiseGit-> submit (C)-> "master". Or: Commit-> master.
Pop-up submit (Commit) dialog box:
As a good habit, fill in the submission log, check the documents to be submitted, and then click the "OK" button to submit to the local warehouse.
3.3 push projects submitted locally to the online warehouse
Push is the next step in submitting.
Click the right mouse button in the space of the local project and select TortoiseGit-> push. Or: Push....
Pop-up push (push) dialog box:
Generally keep the default, click the OK button.
Then the push progress screen pops up, which may ask you to enter a user name:
Determine the OK and then ask for a password:
After the password is entered correctly, OK displays the successful push interface:
If you follow the settings in the previous section, you will remember the password later. The password will be stored in plain text in a file like C:\ Users\ Administrator\. Git-credentials, please use it carefully.
3.4 pull items (pull...)
If the local project is not as new as the online warehouse, you need to perform a pull operation (Pull.).
Click the right mouse button in the space of the local project and select TortoiseGit-> pull. Or: Pull....
Pop up the pull dialog box:
[if pulling BUG, do not use rebase, download the latest TortoiseGit], go to the pull progress page:
Then perform the change base:
[if pulling BUG, please do not use rebase, download the latest TortoiseGit]
And then finish it.
Thank you for reading! This is the end of this article on "what are the basic operations of Git and TortoiseGit?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.