Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git 进阶指南 #8

Open
kangkai124 opened this issue Feb 28, 2019 · 2 comments
Open

git 进阶指南 #8

kangkai124 opened this issue Feb 28, 2019 · 2 comments
Labels

Comments

@kangkai124
Copy link
Owner

关于 git

@kangkai124
Copy link
Owner Author

git subtree

  1. 从项目repo里下载项目代码(有可能是一个空目录,也有可能是已经开发一半的项目)

    git clone [email protected]:your-name/your-project.git your-local-project-name
    cd your-local-project-name
  2. 从组件库repo里下载框架(template)代码

    --allow-unrelated-histories 强制下载非当前repo里的代码到当前目录

    由于框架代码在项目根目录下,因此我们让这些代码下载后关联到项目repo而不再是框架组件的repo

    git pull --allow-unrelated-histories [email protected]:your-name/your-template.git master

    存疑:下载后是否还可以双向更新框架代码
    注意:如果项目里已经包含了框架代码,则不要执行此步骤

  3. 验证一下框架代码是否能正常启动

    npm install
    npm run serve
  4. 从组件库里下载每个组件代码,-P 参数指定组件在项目里所在的目录,并按每个组件README文件集成到项目

    // 添加一个远程源
    git remote add -f your-component1 [email protected]:your-name/your-component1.git
    git subtree add -P src/components/your-component1 your-component1 master --squash

    注意:如果项目里已经包含了所需组件代码,则不要执行此步骤

  5. 检查一下当前已连接的各个远程库

    git remote -vv
  6. 开发代码,其中可能修改项目代码,也可能修改组件代码...(此处省略10000字)

  7. 提交代码,组件代码也会进入项目repo

    git add .
    git commit -m "..."
    git push origin branch1
  8. 若项目需要使用新版本组件(假设新版本分支名为"v2.0")

    # 若有冲突,需要手工解决
    git subtree pull -P src/components/your-component1 your-component1 v2.0 --squash
  9. 若需要将组件定制代码推送到组件库
    先执行下面的命令,然后提交一个PR给组件管理员审核,后者决定是否合并到master

    git subtree push -P src/components/kfc-timeseries-chart kfc-timeseries-chart branch1

@kangkai124 kangkai124 changed the title git git 进阶指南 Apr 12, 2019
@kangkai124
Copy link
Owner Author

github上文件夹都是灰色-解决办法

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/XIAOZHUXMEN/article/details/51536967

git rm -r --cached some-directory
git commit -m "Remove the now ignored directory some-directory"
git push -u origin master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant