The Git plug-in for Eclipse operation "code submission" and "code conflict"

Source: Internet
Author: User

Object-oriented: A classmate who used SVN.

(Because git it can be said to be a double svn (local server, remote one server)), submit code to have two steps, first committed to the local server, and then the local server is committed to the remote server.

So even SVN's classmates have not used it, so use the SVN well.

A1. Code updates.

Operation in SVN, we will remember before we commit the modified code.

"Update First, submit" (otherwise your partner's code will be covered by you, then your partner will hide in the company corner to draw circles)

So it's working in Git. The same is true. However, one more step is to update "remote server-to-local server" before updating "local server-to-local code".

Let's just do it.

The operation of Eclipse is:

1. Point to the delegate means to update only the "remote server-to-local server" abbreviation (Fetch)

When you update, you are currently updating the project with Git repositories will have a similar downward arrow, which means that "remote server" has something updated to your "local server", the exact number is the number next to the arrow

2. Pointing to the delegate means "remote server-to-local server" and "local server-to-local code" both perform short name (pull)

(Of course, in order, first "remote server--local server" after "local server--local code")

This operation is in fact for lazy people to use git as SVN, one step update, the official is not recommended to do so, because this way, your local code, there may be a lot of code conflicts, a lot of inconvenience to developers.

So be honest, step by step to update it.

The operation in Android Studio is:

1. Do not know how, in the Android studio there is no two-step update operation, only the above two arrows, are directly the "remote server-to-local server" and "local server-to-local code" are executed,

So once the update is over, you are waiting to resolve the conflict.

A2. Say the update and then submit the code.

In fact, after the update explained, the small partners Know "remote server-to-local server" and "local server-to-local code" relationship,

So the commit code essentially goes like this. "Local code-local server" local server "-Remote server"

Or is it!

In fact, the small partners remember two words just fine.

Commit: "Local code--local server"

Push: "Local server--remote server"

The operation of Eclipse is:

1. From the diagram above, there is an arrow pointing at the changes made in Git.

Then you right-click the project again good, right arrow file. is to perform a commit operation.

Go to the Commit interface

Git commit a compulsive disorder, you must make a comment, otherwise you do not submit.

When you have typed a commit message, commit and commit and Push will be clicked

Commit just commits to "local server"

Commit and Push are done in two steps ("Local code--local server" "Local server--remote server" in order, I will not say next time)

I won't write it back. Because the following are all knocking on the account and password, if you first Push the code, you need to knock.

It's not usually Push, it's just two questions.

First. Your code conflict has not been resolved, a "code conflict" to say the specific explanation

Second. is a nasty network problem. Students I won't be able to help you with this.)

Other, I haven't met for the moment

The operation in Android Studio is:

Exactly the same as Eclipse,

Is that git repositories becomes

Through here you can know your modified code push no

And then.

Then it is the operation of those who fill in the account password, do not say.

b tell me about the code conflict.

1. First say eclipse:

If you have finished modifying the code before you commit the fetch, you have not feel to the code conflict.

I. As long as you commit to the local server, the IDE compiler will automatically tell you that it has been conflicting and requires you to resolve it immediately.

II. If you are more willful. If you want to commit and Push directly, the IDE compiler will also be very wayward to reply to your diagram like this

Reject your push, say you still have a problem not solved.

But you've made a commit, but you can't push it,

This is what you should do to pull, put the code that you just fetch into the "local code", then the IDE compiler will automatically tell you, has been conflicting, requires you to resolve immediately.

And mark the conflicting file as a two-headed arrow

If you still want to push the code now, you get the following:

Repository state:conflicts (simple meaning said: Elder brother, code conflict Ah, after the resolution, then submit it)

Then, after you resolve, save, and find that the file is still like the one that cannot be submitted.

At this point, you should

Perform the "Add to Index" operation, telling the IDE that you have resolved the conflict, such as:

Now you can go to commit, commit and Push, the IDE compiler will pass (actually tell you.) Go, you old man! )

When 2.Android Studio updates the code,

If you press the toolbar's update icon, you will be forced to resolve the conflict if there is a conflict. Appear

By clicking Merge you can clearly know that your code, resolved after conflict code, the server's code

Resolving post-conflict code directly overwrites your local code. (or you click Close and then the conflicting code jumps directly in your local code, allowing you to modify it in the local code.) )

After resolving the conflict, you can commit and push. A little easier than eclipse.

The Git plug-in for Eclipse operation "code submission" and "code conflict"

Related Article

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.