Git ll & Github

Branch

在团队协作中,不可能全部人都同时使用同一支档案,也就代表我们需要各个击破,这就是分支的概念

git branch

https://ithelp.ithome.com.tw/upload/images/20210523/20130419mV3hAbTUaW.png

*代表目前所在的分支

建立分支
git branch "branchName"

https://ithelp.ithome.com.tw/upload/images/20210523/20130419DqETnEm7B3.png

switch branch

git checkout "branchName"

https://ithelp.ithome.com.tw/upload/images/20210523/20130419tWcSH9Ghoy.png

当我们在分支commit之後
https://ithelp.ithome.com.tw/upload/images/20210523/20130419TSz2PUavbq.png
会看到刚刚commit的log


但当我们切换回main
https://ithelp.ithome.com.tw/upload/images/20210523/20130419z11k39taPw.png
会发现没有刚刚branch的commit这就是分支的概念,分而治之

Branch merge

  • step1 add
  • git status
  • step2 commit
  • git log
  • step3 merge
  • https://ithelp.ithome.com.tw/upload/images/20210523/20130419pnJNYZeaz2.png

Github

先创立一个repository
https://ithelp.ithome.com.tw/upload/images/20210523/20130419ceQtj9j8Sw.png
然後复制这行网址
https://ithelp.ithome.com.tw/upload/images/20210523/20130419JfOiL2S4mv.png

回到cmd

git remote add origin <"复制的网址">
git push -u origin main 

https://ithelp.ithome.com.tw/upload/images/20210523/20130419ijNUMiv3zs.png
上传完成之後回到Github就可以看到repository已新增好了
https://ithelp.ithome.com.tw/upload/images/20210523/20130419m4Rb7WTHaK.png


Another push way

  73 git clone https://github.com/zhangyangzhong/test.git
  74 ls
  75 cd .\test\
  76 code .
  77 git init
  79 git add --all
  80 git commit -m "login page"
  81 git push https://github.com/zhangyangzhong/test.git

Pull

git pull = git fetch + git merge

当我们今天已经团队开发中了,有好几位同事都在push新档案,但你手上的版本是比较旧的这个时候系统不会让你push上去,我们就需要先更新自己的版本才能推

git pull <"网址">

如果不想要有额外的commit

git pull --rebase

<<:  进击的软件工程师之路-软件战斗营 第十三周

>>:  如何使用2Captcha的谷歌拓展程序绕过验证码

[Day 28] 来做一个人脸互动的程序吧!

在我完成人脸关键点与人脸对齐的学习後,觉得眼睛有点累想要休息 -- 这时一个应用就出来了! 我们每...

javasScript 进阶笔记二 (object.prototype.call)

Object.prototype.call(变数)可以更详细地找出变数的型态 console.log...

Day04 - Docker 简单指令操作

查看服务,进入Container 查看docker启用哪些service $ docker-comp...

【Day 02】 何谓 Data Analytics Pipeline

随着数位时代的来临,企业内数据皆已指数级增长,而多数企业也加快数位转型脚步并推动『以数据驱动的决策模...

Day 11: 人工智慧在音乐领域的应用 (机器学习/深度学习与类神经网路二)

机器学习简介 (Machine Learning, ML) 机器学习是一种透过资料、特徵撷取以及训练...