Git: Use tortoisegit to operate git.

Source: Internet
Author: User
Tags using git

To improve the efficiency of git usage, more git graphical tools are used to operate git. (In special cases, git command lines are used to operate git.) If the graphical tool interface provided by git is not friendly enough, you can choose a third-party git graphical tool. There are many third-party git tools available on the market. Only tortoisegit is more practical, the advantage is free and open-source. It has installation packages in various languages and is easy to use. The disadvantage is that it can only run Windows platforms. Next, we will summarize how to use tortoisegit for project version control.

 

1. tortoisegit sets the account password

Configure your account and email

Delete your account creden.

PS: There are several types of creden。. Here we only use "Manager-current Windows user" as an example.

Open the control panel of windows ".

Find "User Account" and click.

 

Find "normal credential" and click "delete from saved Database ".

After clearing the account, submit the code using git and then enter the account and password again.

 

2. tortoisegit quickly creates a local repository

After the creation is successful, the. Git file will appear in the directory.

If no, it is because the GIT directory is hidden. Set Folder Options to display hidden files.

The. Git file directory is used to record the operations we perform in the repository, such as adding, deleting, and modifying files.

 

2. tortoisegit submits code.

Step 1: Submit the code to the master branch of the local repository.

Enter "log information" and click "OK.

 

Step 2: Push the master branch of the Local warehouse to the master branch of the remote warehouse.

Click "OK.

 

PS: Of course, you can set it to "Submit and push" and use git in the svn working mode.

Remember to submit the code before pushing.

 

 3. tortoisegit quickly creates a gitnore ignore file and adds it.

View the. gitignore file and ignore the file path.

 

4. tortoisegi view the submission log. 

All records can be viewed here

Compares the differences between file versions.

View content differences between specific files.

 

5. tortoisegi.

PS: You can trace and understand file changes.

 

 6. tortoisegi solves the conflict.

Root cause of conflict: when different branches modify the same file name file, a conflict occurs when the branches are merged.

Scenario: the same master Branch (a common ancestor branch, assuming a p node on the master branch ).

Based on the p-node on the master branch, developer A creates a file test.txt on the branch of the slave node, which writes ABC, then submits the file and pushes it to the remote branch.

At this time, the p node on the master Branch has been directed to the node submitted by developer A (assuming it is the P2 node on the master branch ).

The developer B is based on the P node on the master branch. A file test.txt is created on the branch of the slave node, which contains BDC. When developer B submits and pushes the file, the remote master branch merge will cause a conflict.

Because developer B is based on the P node on the master branch, rather than the P2 node on the remote branch based on the master branch, git cannot determine which branch is pushed to the latest on the parent branch, error message.

 

Solution: Find and select a file conflict.

Go to the Conflict Resolution Panel.

Manually resolve the conflict.

After saving, the conflict is resolved.

7. tortoisegi restore the file.

 

Select the file to be restored.

 

8. tortoisegi file cleanup

 

Delete unnecessary files.

 

8. Create a tag for tortoisegi.

Purpose: This label is similar to the software version defined by the user.

Enter the version number.

 

 

9. tortoisegi creates a branch.

Purpose: facilitate the management of software development progress and facilitate project iteration. Each developer does not affect each other and ensures the integrity of the main project.

Create a branch and enter the branch name. Generally, select the master branch.

 

10. tortoisegi Management Branch.

View the status of the current branch.

 

Delete a branch.

 

Switch a branch.

Select a branch.

 

11. tortoisegi remote branch unsubmit.

Method 1: forcibly overwrite the remote branch.

Local Branch

 

Remote Branch

 

 

Restore the current local branch to the target version.

Then force push.

 

Remote branch submission is revoked.

 

12. tortoisegi resumes deleting files.

Assume that the test folder is in the work area and the.zip file is in it.

Delete a.zip in the work area by mistake, but there is no git commit.

Restore the.zip file.

 

Method 1: retrieve from the recycle bin. (The premise is that the files in the recycle bin are not deleted or the files of the same name do not exist)

Method 2: delete all current projects and obtain the complete project from the remote repository git pull again. (The premise is that git commit is not required)

Method 3: git checkout from the local repository. (Highly recommended and convenient)

Select "override work tree change ".

The deleted file is restored.

 

 

Conclusion: The above tortoisegit method is sufficient to solve the basic git usage problems at work. For more advanced tutorials, please visit the GIT official website or tortoisegit official website.

Git: Use tortoisegit to operate git.

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.