Code Monkey home page Code Monkey logo

git's Introduction

1.同一文件被提交到本地仓库,pull操作是否覆盖从库本地代码

  • 主库操作。修改readme文件,提交到远程main分支
  • 从库操作。修改readme文件,提交到远程main分支
  • 信息。failed to push some refs to
  • 需要先使用pull操作将本地代码更新,然后再将代码推到远程main分支
  • pull操作后,readme文件产生冲突
  • image-20220120000444493
  • 主从两次操作都显示在文件中,修改文件后,主库提交,从库pull操作同步

2.从库文件被修改,但未执行commit等命令,pull操作后,是否会覆盖本地文件-

  • 主库push远程仓库
  • 从库修改文件,不执行commit命令,直接执行pull命令
  • image-20220120001904694
  • pull操作被终止,需要在merge之前先执行commit或stash命令
  • 从库执行git stash命令,储藏文件,控制台信息Saved working directory and index state WIP on main
  • 从库执行pull操作,拉取成功,执行git stash pop命令恢复储藏的文件
  • 从库readme文件冲突,将冲突部分处理,从库得到最新代码,push到远程,远程仓库得到最新代码,第二次实验结束

3. 同分分支不同文件的修改

  • 主库文件修改,push到远程仓库
  • 从库新建文件temp.md,编辑内容后,从远程仓库拉代码
  • 新文件没有被清理,只需要再执行add -> commit -> push操作,远程仓库即可获得最新代码

4. 不同分支修改同一文件

  • 主分支修改readme文件,推送到远程仓库
  • 两个分支不冲突

git's People

Contributors

buzuosheng avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.