zl程序教程

您现在的位置是:首页 >  工具

当前栏目

[Git]4. Megre conflicts

Git
2023-09-14 08:59:21 时间
/**
    Collaboration basics
*/
Understand git pull command:

$ git pull   -->> it does two things
    1. $ git fetch              //get file from remote rope
    2. $ git merge master       //merger with local master files

Sometime you might meet this kind of situation:
    For example, you and Jane working at the same time but on different files, Jane finishes her work and 
    commit files to the remote github, then remote github get updated.
    /**/
        To https://git@pshop.com/petshop_online/petshop.git
        ! [rejected] master -> master (non-fast-forward)
        error: failed to push some refs to 'https://git@pshop.com/petshop_online/petshop.git'
        To prevent you from losing history, non-fast-forward updates were rejected
        Merge the remote changes (e.g. 'git pull') before pushing again. See the
        'Note about fast-forwards' section of 'git push --help' for details.
    /**/
    After that, you also wants to commit your files to the github:
        $ git push -u origin master
    It shows error message, because the github has been updated by Jane without your notice
    So what you need to do is:
        $ git pull
    Get all the updated into your local, then push them again:
        $ git push
        
        

/**
    Megre conflicts
*/
 Error message: CONFLICT (content): Merge conflict in README.txt.....
 
 This you need to add the content manually!!!
 After that:
    $ git commit -a
    $ git push