Git usage: git/repo Common commands

Source: Internet
Author: User

Git usage: git/repo Common commands

Git is a popular version control tool. How can it be used through command lines? This article shows you the essence of concentration: a list of common git commands, including some repo operations.

 

Code download
Repo init ...... --> Initialize the branch cd to be downloaded. repoln-s .. /.. /RootProject /. repo/projects --> link to the existing projectsrepo sync --> download the entire project code repo sync + git repository path --> download only the code of a git repository (for details about the git repository path, refer. manifest under repo. xml file)

Single git warehouse operation
Git status --> check the status of the current git warehouse, whether files have been updated, modified, and other git logs --> check all submitted logrepo sync of the current git warehouse. --> synchronize the current git warehouse. If a file in the work area of the former Warehouse has uncommitted changes, the file is subject to the current file and will not be forcibly synchronized with the server. This command is the same as running in the project root directory: repo sync + git warehouse path. Note that repo sync is followed by '. 'git branch + branch name --> Create a local branch git branch-a --> View all branches, including local branches and remote branches, without adding-, only check the local branch git checkout + local branch name --> switch to a local branch git branch-D + local branch name --> delete a local branch git add. --> submit all git commit-am "change records" under the current git warehouse --> submit the changes to the buffer and add repo upload for the changes. --> submit the modification to the gerrit server for review
Operate the entire project 
Repo start + branch name -- all --> Create a local branch for each git warehouse in the project, and switch to the repo status --> View the status of each git warehouse in the current project, you can redirect the result to a txt file for ease of viewing: repo status> projectStatus.txt repo forall-c "git command" --> execute the same git command for each git warehouse in the project

Tag The git warehouse for version release. Generally, only the Gerrit permission can be used.
Git tag --> displays the list of all tags in the current git warehouse.
Git tag-n
  
   
--> The description is displayed when the tag list is displayed,
   
    
Specifies the number of lines to be displayed.
   
  
Git tag-l v2 * --> use wildcards to filter the tag list. For example, only tags starting with "v2" are displayed. Git tag-
 
  
   
    
[
    
     
] --> Create a tag (version number) for the git warehouse. If commitID is not specified, a tag is created based on the latest commit. If a commit ID is specified, a tag is created using this commit. After the command is run, an edit window is displayed to enter the description of the tag. Git tag-m
      
      
        [
       
         ] --> The same command, the difference is that the tag description is provided directly in the command line.
        
          The edit window is not displayed after running. Git tag-d
         
           --> Delete the created tag, which cannot be recovered. Use it with caution!
         
        
       
      
     
    
   
  
 


 

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.