• Git的使用 checkout push merge


    D:laragonwwwlaravel-qa>git branch
    * master

    D:laragonwwwlaravel-qa>git checkout -b lesson-2
    Switched to a new branch 'lesson-2'





    D:laragonwwwlaravel-qa>git status On branch lesson-2 Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: app/User.php Untracked files: (use "git add <file>..." to include in what will be committed) app/Http/Controllers/QuestionController.php app/Models/ database/factories/QuestionFactory.php database/migrations/2020_05_09_192154_create_questions_table.php no changes added to commit (use "git add" and/or "git commit -a") D:laragonwwwlaravel-qa>git add -A warning: LF will be replaced by CRLF in app/User.php. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in app/Http/Controllers/QuestionController.php. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in app/Models/Question.php. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in database/factories/QuestionFactory.php. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in database/migrations/2020_05_09_192154_create_questions_table.php. The file will have its original line endings in your working directory D:laragonwwwlaravel-qa>git commit -m "generate question model via artisan model generator" [lesson-2 1851bad] generate question model via artisan model generator 5 files changed, 174 insertions(+) create mode 100644 app/Http/Controllers/QuestionController.php create mode 100644 app/Models/Question.php create mode 100644 database/factories/QuestionFactory.php create mode 100644 database/migrations/2020_05_09_192154_create_questions_table.php D:laragonwwwlaravel-qa>git push -u origin lesson-2 Enumerating objects: 22, done. Counting objects: 100% (22/22), done. Delta compression using up to 6 threads Compressing objects: 100% (13/13), done. Writing objects: 100% (14/14), 2.51 KiB | 367.00 KiB/s, done. Total 14 (delta 4), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (4/4), completed with 4 local objects. remote: remote: Create a pull request for 'lesson-2' on GitHub by visiting: remote: https://github.com/dzkjz/laravel-qa/pull/new/lesson-2 remote: To https://github.com/dzkjz/laravel-qa.git * [new branch] lesson-2 -> lesson-2 Branch 'lesson-2' set up to track remote branch 'lesson-2' from 'origin'. D:laragonwwwlaravel-qa>git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'. D:laragonwwwlaravel-qa>git merge lesson-2 Updating ad06dbf..1851bad Fast-forward app/Http/Controllers/QuestionController.php | 85 ++++++++++++++++++++++ app/Models/Question.php | 24 ++++++ app/User.php | 8 ++ database/factories/QuestionFactory.php | 12 +++ .../2020_05_09_192154_create_questions_table.php | 45 ++++++++++++ 5 files changed, 174 insertions(+) create mode 100644 app/Http/Controllers/QuestionController.php create mode 100644 app/Models/Question.php create mode 100644 database/factories/QuestionFactory.php create mode 100644 database/migrations/2020_05_09_192154_create_questions_table.php D:laragonwwwlaravel-qa>git push -u origin master Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 To https://github.com/dzkjz/laravel-qa.git ad06dbf..1851bad master -> master Branch 'master' set up to track remote branch 'master' from 'origin'. D:laragonwwwlaravel-qa>

    git checkout –b lesson-2

    执行后

    之后的编辑结果都在该分支

    当执行git checkout master切换到主节点后,会发现修改的代码或新增的文件都消失了,但是

    执行 git merge lesson-2之后,就会将lesson-2的修改结果融合到主分支,lesson-2修改的代码或新增的文件就又都回来了。

  • 相关阅读:
    前端程序员的进阶
    字符集的知识
    通晓多种编程语言的程序员,真香?
    理解 Docker
    免费开源软件的潜在安全风险
    技术编程人员成长的 9 个段位
    如何更好的设计 RESTful API
    selenium环境搭建:
    自动化测试有哪些?
    删除书籍:
  • 原文地址:https://www.cnblogs.com/dzkjz/p/12863065.html
Copyright © 2020-2023  润新知