简体   繁体   English

在开源项目中使用 Git

[英]Using Git with an Open Source Project

I have to work on a project to develop a module for the platform MagicMirror² ( https://github.com/MichMich/MagicMirror ), and as I am a beginner with Git I don't know how to do to simply import the files and work with them to test my module.我必须在一个项目上为MagicMirror²( https://github.com/MichMich/MagicMirror )平台开发一个模块,因为我是Git的初学者,我不知道如何简单地导入文件并与他们一起测试我的模块。

What I did was to import a repository, but now I see that the project is getting modified regularly, so I suppose this is for people who want to improve it and are pushing their changes.我所做的是导入一个存储库,但现在我看到该项目正在定期修改,所以我想这是为那些想要改进它并正在推动他们的改变的人准备的。

So what should I do if I simply want to develop my module, while if possible benefiting from the updates of the main project ?那么,如果我只是想开发我的模块,同时尽可能从主项目的更新中受益,我该怎么办? Should I import the repository, commit and push my changes of my module, without having the risk to mess up the original project or should I simply make a new repository ?我应该导入存储库,提交并推送我对模块的更改,而没有弄乱原始项目的风险,还是应该简单地创建一个新的存储库?

I also saw these branches, forks "things", I understand the concepts, but I don't know how should I use them.我也看到了这些分支,叉子“东西”,我理解这些概念,但我不知道我应该如何使用它们。

Thank you谢谢

For start, you need to have Git installed.首先,您需要安装Git After that, find the repository URL, in your case it's:之后,找到存储库 URL,在您的情况下是:

https://github.com/MichMich/MagicMirror.git

and do

git clone https://github.com/MichMich/MagicMirror.git

After that, you can simply checkout (create) a new branch:之后,您可以简单地签出(创建)一个新分支:

git checkout -b [branchname]

and work/commit/push on this branch.这个分支上工作/提交/推送。 You will not affect content that is in other branches and while pushing, you will be asked to merge/rebase etc.您不会影响其他分支中的内容,并且在推送时,您将被要求合并/变基等。

Also, keep in mind that git pull -ing new changes might cause damage, read this article to have a deeper understanding.另外,请记住git pull -ing 新更改可能会造成损坏,请阅读本文以更深入地了解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM