小众GIT

作者: 一只重拾梦想的小水 | 来源:发表于2019-08-02 11:51 被阅读0次

1、git reflog: 操作记录,找回reset等误操作

2、git rebase --todo

3、git submodule:

参考:https://codewinsarguments.co/2016/05/01/git-submodules-vs-git-subtrees/

a. 解决了什么问题
需要用到公共类库 library
类库特点:业务相关&公用
即有与业务代码一起开发的需要(为什么不用npm:npm包需要频繁发包更新版本),又要在多个项目中可共用

参考:http://www.ayqy.net/blog/%E7%90%86%E8%A7%A3git-submodules/

b. 对比subtree:

简而言之:
  • Submodules are easier to push but harder to pull – This is because they are pointers to the original repository
  • Subtrees are easier to pull but harder to push – This is because they are copies of the original repository
分开来讲:
  • Submodules:
    适用:
    Need to push frequently
    本质:
    a submodule is nothing but a pointer to a specific commit in an external repository
    **issues: **
    1.Changes to the parent could be committed and pushed without having committed and pushed the changes to the submodule. (to commit&push sub+commit&push super)
    2.If a collaborator has modified and pushed changes to a submodule but you haven’t run git submodule update to update the submodule on your machine to their latest version, you may run git add -A and downgrade to your out of date version.( to git submodule update )
    issue eg:
Git commit sub(without push)
git commit&push super
// Clone repo: 
Git pull super
git submodule update
without push subproject
golden rule
Always commit and push the submodule changes first, before then committing the submodule change in the parent repository.
Tips:
If you define an alias which runs git submodule update after every single git pull then you will be safe, but a newbie is unlikely to do this.
  • Subtree:
    适用:No need to push ( then why not npm? npm不提供源码细节 )
    注意:there will be nothing in the dir to indicate that the folder ever came from another git repository.
    issues:
    1.So slow in a large repository on Windows
    2.very little documentation

相关文章

  • 小众GIT

    1、git reflog: 操作记录,找回reset等误操作 2、git rebase --todo 3、git ...

  • 小众

    小众 小众 小众 …… 人就好众啊

  • 小众能否做成大单品?

    想做小众,因为小众是强需求,有黏性;不敢做小众,因为怕小众做不大。 想做大众,因为大众的盘子更大;大众没做大,因为...

  • 千奇百怪收拥有小众单品,不如拥有小众审美

    不知道你有没有发现,那些曾经小众的品牌已经不再小众了。 由于这个社交媒体发展空前的时代,所有的小众品牌或者小众单品...

  • 偶尔伤感

    小众的就让他永远的小众下去吧。不要大众

  • 江小白:哪怕只是小众,也能站在舞台中央

    小众从来就有,小众站在舞台中央的现象过去也有,但通常是小众变成了大众流行之后。 小众直接站在舞台中央,则是现在才有...

  • 今生,再也不能陪你一起数天上的星星了

    但能陪你一起看天上的云彩? 大波浪~ 做人要做小众人,喝酒要喝小众酒。小众酒,你值得拥有

  • 爱情的理想主义

    你是大众还是小众?你追求大众爱情还是小众爱情? 2017-03-15大周/Justice小众爱情 相信很多人都知道...

  • 小众

    我们为什么要追求别人的认同? 为什么要让别人觉得我们拥有美丽、有钱、能干、有趣等特质? 在社交场合上装有趣很容易,...

  • 小众

    你是否是最合群的那一个,亦或是喜欢安静思考,还是有些社交恐惧症的人,一花一世界,一叶一菩提,大千世界每个人都不一样...

网友评论

      本文标题:小众GIT

      本文链接:https://www.haomeiwen.com/subject/cbtldctx.html