github 和git_Google编码文档:Git和GitHub

github 和git

by Yung L. Leung

梁永良

Google编码文档:Git和GitHub (The Google Doc of Coding: Git & GitHub)

介绍 (Introduction)

Google Doc is a server-side (online) word processor. A user’s files are created via a web browser & stored in a server. This software makes it possible for users to share documents with others for collaboration. Normally, the workflow is the following:

Google Doc是服务器端(在线)文字处理器。 用户的文件是通过Web浏览器创建的,并存储在服务器中。 该软件使用户可以与他人共享文档以进行协作。 通常,工作流程如下:

  • Create a document & fill with content.

    创建一个文档并填充内容。
  • Save content & share file with others for collaboration.

    保存内容并与他人共享文件以进行协作。
  • Members contribute on the same document, online.

    成员在线发表同一文档。

Aside from file sharing, another important feature is the ability to undo or redo changes made to the ‘master’ file. The changes made to the document are sequential and any user can undo (or redo) those changes.

除文件共享外,另一个重要功能是能够撤消或重做对“主”文件的更改。 对文档所做的更改是顺序的,任何用户都可以撤消(或重做)这些更改。

But, this can quickly become a big mess, especially when multiple users are simultaneously adding or editing content. Who created or changed what content and for what reason is unknown.

但是,这很快就会变成一团糟,尤其是当多个用户同时添加或编辑内容时。 谁创建或更改了哪些内容以及出于什么原因而未知。

Atom,Git和GitHub (Atom, Git & GitHub)

In software development, the tools for collaborative programming consists of a text editor, version control system & an online repository.

在软件开发中,用于协作编程的工具包括文本编辑器,版本控制系统和在线存储库。

Atom (or any text editor) is like your client-side (desktop) word processor, except the document is code written in some language (i.e: JavaScript).

Atom(或任何文本编辑器)就像您的客户端(台式机)文字处理器一样,不同之处在于文档是用某种语言(即JavaScript)编写的代码。

Git is a tool for selectively recording the history of your project’s saved changes. It is a way to ‘control’ all the different versions of your programming project.

Git是用于选择性记录项目保存的更改历史的工具。 这是一种“ 控制 ”编程项目的所有不同版本的方法。

GitHub is like your Google Docs, except you can create & save your version of the code offline, before ‘pushing’ it to be saved online.

GitHub就像您的Google文档一样,只不过您可以脱机创建和保存代码版本,然后再“ 推送 ”以使其在线保存。

So, you have your text editor (Atom), version control system (Git) & remote file storage system (GitHub). These are the basic elements that solve the problem of collaboration, especially for software developers. The workflow is similar to the use of Google Docs, with some differences.

因此,您将拥有文本编辑器 ( Atom )版本控制系统( Git )远程文件存储系统( GitHub ) 。 这些是解决协作问题的基本元素,特别是对于软件开发人员而言。 工作流程类似于Google文档的使用,但有一些区别。

协同软件开发工作流程 (Collaborative Software Development Workflow)

  1. Create online (remote) GitHub repository (https://github.com/new)

    创建在线(远程)GitHub存储库( https://github.com/new )

2. Create an offline (local) repository. The terminal command git init project_name initiates your project by creating a folder to store its content & version control files to store a history of its changes

2.创建一个离线(本地)存储库。 终端命令git init project_name通过创建一个文件夹来存储其内容和版本控制文件来存储其更改历史,从而启动您的项目

  • The idea is to eventually have a remote & a local copy of your project.

    这个想法是最终拥有项目的远程和本地副本。

3. Use a text editor to build content. This is where you begin to write your program with Atom and create your JavaScript files.

3.使用文本编辑器构建内容。 在这里,您可以开始使用Atom编写程序并创建JavaScript文件。

4. Save the content & note significant historical progressions in your project. The terminal command git add . adds all folder contents, all the changes, to be committed in history. The command git commit -m ‘message’ commits the changes to history, along with a message explaining the changes made. The command git push pushes your files and historical data to your remote repository.

4.保存内容并记录项目中的重要历史进度。 终端命令git add。 添加所有文件夹内容,所有更改在历史记录中提交git commit -m'message'命令将对历史的更改以及解释所做更改的消息提交至历史记录。 git push命令将文件和历史数据推送到远程存储库。

  • As you are continuously making progress in your project, you are recording the rationale behind each stage of development (git add, git commit, git push).

    随着您在项目中不断取得进展,您正在记录每个开发阶段(git add,git commit,git push)的原理。

5. Share file with others for collaboration. Once your remote repository has content, you can share your project with collaborators.

5.与他人共享文件以进行协作。 远程存储库包含内容后,您可以与协作者共享项目。

  • After members accept the invitation, they can fork a branch off of the remote repository and clone the project locally (git clone <repo url or ssh>).

    成员接受邀请后,他们可以从远程存储库分支一个分支并在本地克隆项目( git clone <repo url或s sh>)。

  • Each collaborator can build content, save the content and push it to their remote branch.

    每个协作者都可以构建内容,保存内容并将其推送到其远程分支。
  • As collaborators continue to build and save their content, they end up building forks in the GitHub “sky” (git add, git commit, git push).

    随着协作者继续构建和保存其内容,他们最终在GitHub“ sky”( git addgit commitgit push )中构建派生。

  • Each fork is a collaborator branching off from the original project so that members can work in parallel with the originator, without disrupting each other’s progress. Every time a collaborator performs a git push, the fork elongates.

    每个分支都是从原始项目分支出来的协作者,因此成员可以与发起者并行工作,而不会干扰彼此的进度。 每次协作者执行git push时 ,叉子都会拉长。

6. Merge branched files. At the request of the collaborators, the originator can pull their branch to be merged with the master branch.

6.合并分支文件。 应协作者的请求, 发起者可以拉出其分支以与主分支合并。

  • When a collaborator submits a pull request, the originator can perform a git pull to merge the branches into a single updated version of the project. This new version can then be pushed into the remote repo for all to see and use.

    当协作者提交请求请求时,发起者可以执行git pull来将分支合并到项目的单个更新版本中。 然后可以将此新版本推送到远程仓库中,以供所有人查看和使用。

版本控制和文件共享 (Version Control & File Sharing)

In collaborative software development, changes are made to multiple clones of a master copy, before they are merged to the master file. So the changes made are sequential, but with overlaps in time.

在协作软件开发中,在将主副本的多个克隆合并到主文件之前对其进行了更改。 因此,所做的更改是顺序的,但时间上有重叠。

Every new piece of content that is created on a clone is ultimately pushed towards a collaborator’s master repo. Every collaborator’s commit message provides feedback to the originator so that they can make intelligible edits & additions to the original project.

克隆上创建的所有新内容最终都会推向协作者的主存储库。 每个协作者的提交消息都会向发起者提供反馈,以便他们可以对原始项目进行清晰的编辑和添加。

This would be a difficult feat without Git’s version control & GitHub’s file sharing. A simple terminal command (git branch &lt;branch_name>) can take a clone on a local machine and create a branch so that a different version of the project can be developed. A user can then note take their progression (git add & git commit) at any point in time. If there were any problems with an active version, the user can simply switch to a previous branch (git checkout <branch_name>) and continue from there.

如果没有Git的版本控制和GitHub的文件共享,这将是一项艰巨的任务 。 一个简单的终端命令( git branch& lt; branch_n a me>)可以在本地计算机上进行克隆并创建一个分支,以便可以开发不同版本的项目。 然后,用户可以在任何时间记下自己的进度(git add和git commit)。 如果有与现行版本的任何问题,用户可以简单地切换到以前的BR ANCH(GIT CHEC KOUT <br 一个 nch_name>),并从那里继续。

This is the meaning of version control. At any point in time, a user can switch to alternate versions of a project, while committing intelligible notes that explain the progression of each version. The user has full control over the versions that are developed. A simple terminal push to the GitHub “clouds” makes any version available to their collaborators. This is the power of using Git & GitHub in collaborative software development.

这就是版本控制的含义。 在任何时候,用户都可以切换到项目的备用版本,同时提交可解释每个版本进度的可理解注释。 用户可以完全控制所开发的版本。 只需将终端推送到GitHub“云”,即可向其合作者提供任何版本。 这是在协作软件开发中使用Git和GitHub的强大功能。

References:

参考文献:

Git - VideosEdit descriptiongit-scm.comLearn Git with Bitbucket Cloud | Atlassian Git TutorialLearn Git with Bitbucket Cloudwww.atlassian.comHow Google Docs WorksBack End of Google Docs - The back end of Google Docs relies on simple, inexpensive hardware and software. Learn more…computer.howstuffworks.comAtom (text editor) - WikipediaAtom is a free and open-source text and source code editor for macOS, Linux, and Microsoft Windows with support for…en.wikipedia.orgGit - WikipediaGit () is a distributed version control system for tracking changes in source code during software development. It is…en.wikipedia.orgGitHub - WikipediaGitHub offers plans for enterprise, team, pro and free accounts which are commonly used to host open-source software…en.wikipedia.org

Git- 视频 编辑描述 git-scm.com 使用Bitbucket Cloud学习Git | Atlassian Git教程 通过Bitbucket Cloud学习Git www.atlassian.com Google Docs的工作 原理 Google Docs的 后端 -Google Docs的后端依赖简单,廉价的硬件和软件。 了解更多信息…… computer.howstuffworks.com Atom(文本编辑器)-Wikipedia Atom是针对macOS,Linux和Microsoft Windows的免费开放源代码文本和源代码编辑器,并支持… en.wikipedia.org Git-Wikipedia Git( )是一个分布式版本控制系统,用于在软件开发过程中跟踪源代码的更改。 它是… en.wikipedia.org GitHub-Wikipedia GitHub提供了企业,团队,专业人士和免费帐户的计划,这些计划通常用于托管开源软件… en.wikipedia.org

翻译自: https://www.freecodecamp.org/news/the-google-doc-of-coding-git-github-ec103e87926d/

github 和git

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值