git - 3 ( remote、git pull = git fetch + git merge )

1. 远端数据库 - git remote

如何推送分支到远端数据库

(1) 建立新专案并连接本地数据库
https://ithelp.ithome.com.tw/articles/10283424

  1. git push - 推送数据库到 Github (clone + push)

(2)建立分支
https://ithelp.ithome.com.tw/articles/10283424
6. git branch - 分支创立

(3)此时git push
会出现指令提示要选择推送的远端数据库
之所以会这样的缘故是因有非常多的数据库(有正式的或是测试用的),
那他第一个预设通常都是 origin 就像 master 一样
https://ithelp.ithome.com.tw/upload/images/20220105/20137684yX39DjBk8U.png

(4)查询有多少个远端数据库

git remote

(5)修改远端数据库名称

git remote rename 原名称 修改名称

(6)push

git push '数据库名称' '分支名称'
https://ithelp.ithome.com.tw/upload/images/20220105/20137684Y23lxN0r0f.png

没有数个数据库时直接使用git push即可
(本地与github,至少有两个数据库)


2. 下载远端数据库 - git pull

(1)把同事更新在远端数据库(push github)内的commit纪录拉下来

git pull

(2)状况:同事A无法push
https://ithelp.ithome.com.tw/upload/images/20220106/20137684pbquK3U9dK.png
此时同事A要git pull把资料拉下来,无冲突:此时系统会自动merge
https://ithelp.ithome.com.tw/upload/images/20220106/20137684PaBUZ5eW3f.png


3.小型团队分支协作

https://ithelp.ithome.com.tw/upload/images/20220106/20137684txdNHXTelT.png


4. git pull = git fetch + git merge

pull 时,远端的分支将本地分支进行合并 merge 的动作
不希望 pull 下来导致自己的数据库太乱又担心有冲突时,可以先使用下面这个指令。

git fetch origin(远端数据库) branch1(远端分支)

此时分支会多一个 FETCH_HEAD 的分支,这个就是远端数据库的分支,可以等看过没问题後
再合并 FETCH_HEAD 也 ok。


<<:  Leetcode (Algorithm I): 5. Search Insert Position

>>:  React-banner轮播

Day 3 安装 RSpec 以及环境设定

该文章同步发布於:我的部落格 检查电脑是否有 Ruby 铁人赛文章主要以 Mac 作业系统为主,避...

[Day 15] ML 实验管理 — 翻开覆盖的陷阱卡~ 记帐小本本!

All life is an experiment. The more experiments y...

Day.3 天秤的两端

为了解释时间跟空间的取舍,来一条leetcode的题目,就是最经典的第一题Two Sum 输入一组a...

【Day8】 Introduction – while & for

紧接着,我们就要来介绍 while、for 回圈啦!但是在介绍之前,要先提到一些基本但常用的运算子。...

【Day2】声音的一些基本介绍

声音这东西实在是太自然了,所以我们很少去思考这东西的本质到底是什麽 简单的来复习一下声音是什麽,你...