Repo operations and FAQs

    Repo is Google using a Python script to write a script to call git, mainly used to download, warehouse management software Android project.

First, for the first time to configure the environment and initialize repo:

1, first configure the environment:

mkdir bin              // Create a bin directory in the root directory 

cp repo bin /                     // presupposes the existence of this repo repo file will be copied to the bin directory. 

Export the PATH = $ the PATH: ~ / bin       // adding environment variables 

mkdir work_repo            // root create a directory work_repo directory for storing project

2, initialize the warehouse: 

work_repo CD            // switch to the directory work_repo
 
the repo the init -u SSH: // XXX XXX -b -m xxx.xml         // initializes the address according to specific project

In the initialization process, the situation can not access the Web site may appear, it can be modified as follows:

Still under work_repo catalog, 

RM *. RM .repo / - the RF 
cd ..              // switch back to the root directory of 
vim bin / repo             // instead of https in the latest file access repo address: // gitee.com/FlymeGit / repo 
after modification, change directory to work_repo, then perform the initialization command.      


    


3, synchronization code

repo   Sync   -c --no-Tags             // first general use this command to synchronize all the code (Android entire source)

If only update a module, you can use the command:

repo   Sync   -c -d XXX                  // XXX module name

Second, the FAQs:

1, a problem may occur when the repo sync, for the project has been compiled, there will be many new files created or modified. If you need to remove these files, and many will go back and restore all modified files, you can run the following two commands:

repo forall -c "git reset --hard HEAD"

repo forall -c "git clean -df"

But the android out following directories need to manually clear: rm -rf out.

On this basis, then repo sync general would be no problem.

2. When submitting the code appear insufficient permissions possible reasons:

  Check the repo configuration information, user name + email + key, etc. for errors, view the config file (because some displayed in the command is correct, but the configuration file is wrong, there may be illegal characters, etc.).

3. Create a local temporary branch to modify the code, for other reasons, cut directly back to the main branch, the following problems occur:  

    Modify the temporary branch also acts on the main branch

Causes: before switching to the main branch, no branch on the temporary modification submitted.

At this time, it may be used as follows :( This history filed that more clear and clean)

( 1 ) If the locally modified, the first execution 
        Git stash           // save local modifications 
( 2 ) Git pull --rebase        // before updating to modify 
( . 3 ) Apply Git stash          // restore a local change log 
( 4 ) and normal the git add, git commit submit other operations. To verify has passed.

 4, which is appearing in my development issues, problems may arise each person is different, not necessarily suitable for all, be it a thought!

 5, recommended that:

  For understanding the use and meaning of the command, the best test to verify their own locally in Git-Bash, it will not only help to understand, but also to verify its correctness, the Internet is not necessarily all right!

  repo only management tools. So in addition to upload, sync all code, other local operations are a variety of command git! ! !

Guess you like

Origin www.cnblogs.com/sparrowlhl/p/11284266.html