git repo use experience (kernel)

Source: Internet
Author: User
Tags svn using git git clone

Git is quite a version control tool with Svn,cvs, repo encapsulates the operation of git, making the git command more simplistic,

Git learning site This is before you see, but the actual work of the operation or encountered a lot of difficulties, always encounter conflicts, can not submit problems, and now the use of git is not very familiar, but now the use of basic understanding, so that a brief introduction.

When using Git, it was developed under Repo,windows, using the Cygwin tool, which is better than Git's bash. Use Git to understand that the add,commit operation will not image remote code warehouse, only push will push the code to the remote warehouse, a step more than SVN; here is my operation for example:

1. mkdir Gitlearn

2.CD Gitlearn

3.repo init-u ssh://xxx-m xxx.xml Pull Remote Code

This is actually the equivalent of GIT's two operations:

Git init

git clone git@github.com:wufengxyz/hellogit.git This is a warehouse I have on GitHub, and this site also provides a guide to learning about Git

4.repo start xxx <project. > To create a branch, in Project engineering, can be a number of projects, these projects are to be modified by themselves, in the use of Git must open branch, otherwise the conflict can not be resolved,

This quite with Git branch xxx (branch name) git checkout xxx, create a branch, switch to this branch (repo can operate multiple projects, modules, and Git is a single project)

5. Into an open branch of the project, Git branch-a, to see if the branch

6.git status, be sure to use the command more times, to view the status of changes

7. Start modifying on branches, adding operations, etc.

8. Modified the code, then use the

git Add.

git commit-m "bug fix"

9. The next step is to synchronize the remote code.

Repo Sync xxx (project name)

10. Now the remote code has been down, I believe we all as long as there will be conflicts appear possible

Conflicting modifications, using git rebase--continue This is the equivalent of merging these changes into the submission of the last conflict.

11.repo Upload This step is to push the code to the Remote code Audit warehouse, our leader will review our code, through the development of the task completed, not by continuing to modify

12.review not by doing the following, it should be noted here that our code has been submitted to the remote repository, which is a difference from the git rebase operation

Modify code that is not passed ... After the modification is complete, git Add., git commit-m "xxx" completes a commit, and then uses

Git rebase-i head~2

Pop-up an interface pick 0b92779 Test commit two pick 9d80074 rebase test Merge two times pick, change the second pick to S, as follows pick 0b92779 Test commit two S 9D8 0074 rebase test Esc:wq Save changes pop up an interface, delete the subsequent change-id (DD operation, delete the entire row) Esc:wq Save the changes then repo upload upload the modified code to complete all the submission process, After the full pass on a repo sync sync the Remote warehouse code, remember to use git status, or repo status command, must have a 4th step before each change. Next, if Git is completely unable to submit a solution using the case, often because the branch is not open, to back up their own modified code, then repo sync to the remote code base in the latest code in sync, and then use the backup code to overwrite the latest code, so after the operation using Git The status will find the code that you have modified, then in the IDE project to see what is different from the latest version of the remote, the remote code has, but their current code does not add, and then the normal submission process is OK, why so everyone think about it is equivalent to the latest version of the code to make changes. These are just the basics of git, and you want to help your classmates who just used 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.