码迷,mamicode.com
首页 > 其他好文 > 详细

Git的使用 checkout push merge

时间:2020-05-10 14:45:30      阅读:57      评论:0      收藏:0      [点我收藏+]

标签:代码   ati   dir   rate   data   commit   文件   +++   creat   

D:\laragon\www\laravel-qa>git branch
* master

D:\laragon\www\laravel-qa>git checkout -b lesson-2
Switched to a new branch ‘lesson-2‘





D:\laragon\www\laravel-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:\laragon\www\laravel-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:\laragon\www\laravel-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:\laragon\www\laravel-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:\laragon\www\laravel-qa>git checkout master Switched to branch ‘master‘ Your branch is up to date with ‘origin/master‘. D:\laragon\www\laravel-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:\laragon\www\laravel-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:\laragon\www\laravel-qa>

git checkout –b lesson-2

执行后

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

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

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

Git的使用 checkout push merge

标签:代码   ati   dir   rate   data   commit   文件   +++   creat   

原文地址:https://www.cnblogs.com/dzkjz/p/12863065.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!