Summary of the Project Code management tool git

Source: Internet
Author: User
Tags git commands

In project development, the synchronization of code is important, and several people in the team can manage their own open source project code through free GitHub, which is efficient and convenient. Here's a list of GIT commands that are often used in development, based on the GitHub platform.

0. Configure the submitter's account and mailbox name

git config--global"Your Real Name"    --global User.email [ Email protected]           //Email

1 Create the warehouse locally and sync to remote GitHub.

$git init                    // Initialize $git Add.                   // add all the files to the index (do not want to add all the files, you can use Gitignore or add specific              files) $git commit// submit to the local warehouse, and then fill in the Update log (fill in the update log-m, such as $git Commit-M "My first vesion of ...") $git remote add origin [email protected]:wadeleng/hello-world.git  
   
    // 
    added to remote
    $git push Origin master    
    //
    push to GitHub
   

2 Clone a project on GitHub to a local

$git clone [Email protected]:wadeleng/hello-World.git If the code is already in place, and there are updates in the repository, merge the changes into the local project: $git Fetch Origin     // get remote update $git merge Origin// merge updated content into local branch

3 Update Project-Create a new file

$git Add.                  // this will automatically determine which files are added, or manually add the file name $git Commit               // submit to the local warehouse, no parameters will prompt, note: ^=ctrl, follow the prompts to be good ~ ~ ~ $git push Origin master     // not newly created, no more add to remote.

4 Update Item-no press created, just modified file contents

$CD ~/hello--          a// record which files were deleted or modified $git push Origin  Master//  Submit to GitHub

5 Ignore some files when uploading

$vim. Gitignore    // Add File type to. gitignore, save then git Add. can automatically filter this file

6 Revocation and deletion

$git Reset  // undo $git rm  //  Delete

Remarks Common exception resolution

1.$ git remote add origin [email protected]:wadeleng/hello-world.git

Error tip: Fatal:remote origin already exists.

WORKAROUND: $ git Remote RM origin

Then execute: Git remote add origin [email protected]:wadeleng/hello-world.git will not report an error

2. $ Git push origin master

Error hint: error:failed to push som refs to

Workaround: Git pull Origin master//put the file above github on the remote server first, then push it up.

The local code must be guaranteed to be up-to-date in the remote, otherwise it cannot be submitted and the company Debase every day.

Administration of the branch to be continued, SSH encryption, etc.

Favorite: http://blog.csdn.net/djl4104804/article/details/50778717

Summary of the Project Code management tool 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.