github.com git and Tortoisegit graphics tutorials

Source: Internet
Author: User
Tags git commands

The method of file management using GitHub account + Msysgit + tortoisegit under Windows system is introduced.

Installation

Installing Mysysgit

: Msysgit

Installation process:

0. Start

1. Default

2. Default

3. Default

4. Default

5, this step is very important, select Checkout as-is. When you use Git clone, Git does not change the line breaks for the obtained files.

6. Default

7, the installation is complete.

Installing Tortoisegit

: Tortoisegit.

installation process

0. Start

1. Default-next

2, the default-next(note that this step in addition to the installation path changes, the other remains the default!) )

3. Default-next

4. Default-install

5. Complete

Terms

    • repository Repository, a database that contains file history and configuration information, usually containing multiple branches;
    • clone repository cloning refers to a copy of the warehouse, a new clone contains the original warehouse of various information;
    • Push submits the data to the remote repository;
    • pull fetches data from the remote repository or local branch and merges it into the specified branch;
    • Branch different development routes;
    • Merge merges data into branches;
    • commit To log the file changes to the repository;

Set up

Tortoisegit settings

Start and all program->tortoisegit->settinigs, fill in the Name and Email information.

It is necessary to note that the Name & Email message is required each time a file is submitted via Git. This information will be displayed in GitHub's commit record along with commit Comment .

After we have successfully uploaded the file to GitHub, the repository Name will be reflected in the Commit record.

For the sake of simplicity, all other setup items are not modified for the time being, and can be gradually explored in use.

Usage

Use with GitHub

1, Login to GitHub (if no account, you need to create a new account). Click on the Sign in button to enter the landing page, fill in the user name (or email) and password after landing. (User name and mailbox name are case-insensitive and passwords are case sensitive)

2. Enter account Settings and add SSH Key. SSH Key is the password used by the user to log in or upload files to GitHub using the SSH tool (which is the integrated tool in the Tortoisegit).

3. Go back to Local on GitHub. We need to add SSH Key, but we don't have it yet, so make a first. Start All Programs->tortoisegit->puttygen

Click the Generate button to start the build and move the mouse over the specified area to accelerate the generation of SSH keys .

Save the key by clicking Save Private key. Since we did not set the password, a window will pop up asking if we really don't need to set up SSH key protection password. After setting the password is more secure, but in the use of each push file will prompt you to enter this password, more verbose, here can be selected according to personal preferences.

Students who do not need to set a password can skip

do not close Puttygen below also need to use , if very unfortunate you did not see this hint. Then it doesn't matter, do it again.

Students who don't want to do it again can open the key that you just saved, file->open private key . If a classmate has been re-done, then congratulations, you recruit.

4, organize your thoughts back to GitHub website, I believe that the page you have not closed, if closed, or can not find, then re-landed on your GitHub, right corner click Account Settings , and then find SSH Keys , click Add SSH Keys to start adding.

Switch to the Puttygen software and copy the public key to the Add an SSH key --key window on GitHub. Click Add Key , then enter the GitHub account password in the password confirmation box that pops up and click Confirm Password to complete the Add.

(Note: To "select All")

5. Now that the basic work is done, we can start to build Repository on GitHub and upload files to GitHub to start our GitHub journey.

Click Create New Repo in the upper-right corner to build the warehouse , fill in the name and Description (description), click on the creation repository Library.

After the warehouse is created, your GitHub page is roughly as shown, with several clickable buttons in the red box, Setup in Windows , HTTP , and

    • Setup in Windows does not know how to use it.
    • HTTP Non-encrypted connections, read-only properties, need to be linked in this format when getting other users ' github files.
    • SSH Encrypted link, add to your own warehouse upload files need to use this format link, Here I need to use the link , that is [email protected]:jiapengli/ Gittutorialpractice.git.

6. Now that we have successfully built a warehouse on GitHub, we need to use the Tortoisegit tool to Clone The repository just created, then add the file and upload it.

    • Right -click in Windows Explorer;
    • Select the Git Clone key; Add the address of the Repository (warehouse) to the URL project;
    • Populate the Directory project with the destination folder (empty folder or nonexistent);
    • In the loadputty key project to load the newly created and saved private Key, click the OK button to start Clone;
    • Click Close to exit Clone after the end.

7. Upload files to GitHub.

    • Create a new readme.md in the gittutorial folder;
    • Edit the readme.md , here gives the markdown format of the readme.md sample;
    • In addition, in order to demonstrate the ability to add images in Markdown, create an image folder (the name can be taken casually), and add some pictures to it

    • Right-click in the gittutorial folder and choose Git commit-> "Master" ;
    • In the new pop-up dialog box, select the file you want to upload, fill in the message (message content to the title, describe what you did this upload), press OK to confirm;
    • Click the push button in the new pop-up dialog to upload the file; (In actual development, you can choose not to upload at this time, and then upload after multiple commits)
    • In the New Popup dialog box, select local branch, ref-remote (remote branch), destination-remote (remote destination), Since we have only one branch, so these items we choose the default is OK, select Autoload Putty Key , and then click OK to start uploading;
    • We have completed the uploading of GitHub files.

Complete the upload.

Warm tips:

Open source China (oschina.net) Add the public key address is: Http://git.oschina.net/keys

You can also follow the following path: Click on Avatar, edit, add public key .

Tortoisegit git commands for each operation

Delete a remote branch

Git push Origin--delete <branchName>

Or

Git push Origin:<branchname>

Canceling version control of a file

Permanently delete:

git rm files

Delete from warehouse, keep local file:

git rm--cached files

Rename Branch

git branch-m <oldname> <newname>

git branch-m <newname>//Change branch name

Cancel the most recent commit

git reset--soft head^ (--soft Cancel commit retention changes)

git reset--hard head^ (--hard Cancel commit and delete changes)

Canceling file additions

git reset HEAD file

Temporarily hide change/restore changes

Git stash Save

Git stash pop

Show all files not joined to version control

Git status-vu

Branch-to-branch push

Git push Origin Local_branch:remote_branch

Partial history clone to full history clone

git fetch--depth=largenumber

Search git log

git log--all--grep= "STRING"

Create a branch

git checkout-b new_branch_name commit_code_91f7edc6c1f4440c1

github.com git and Tortoisegit graphics tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.