git版本控制 怎么不公开_我不git版本控制

git版本控制 怎么不公开

I was today years old when I learned and understood what Git was. Hidden in the MacOS(and Linux), there is a great functionality that makes any developers life so much easier. It’s no mystery to the programming world and perhaps the millions of developers using it as standard operating procedure. But after learning it today, not one of my projects will be done without using Git.

今天我几岁,我了解并了解了Git是什么。 隐藏在MacOS(和Linux)中的强大功能使任何开发人员的工作变得更加轻松。 对于编程世界以及数以百万计的将其用作标准操作程序的开发人员而言,这并不是什么秘密。 但是,在今天学习它之后,如果不使用Git,就不会完成我的项目之一。

我们来画画好吗? (Let’s paint the picture shall we?)

You are working hard on personal project for weeks, then one day you make a mistake or get rid of the wrong file and the project is broken. How do you restore the project to where it was before you made the mistake? Let’s say you want to add some new functionality to the project, how do you test the new code on your project without messing with that main(master) file? What if you are on a small team and you are all working on the same project changing different lines of code, how do you prevent bugs from two people changing the same line of code? These and more are the things using Git or version control can solve.

您在个人项目上努力工作了数周,然后有一天您犯了一个错误或摆脱了错误的文件,从而导致项目被破坏了。 您如何将项目还原到出错之前的位置? 假设您要向项目添加一些新功能,如何在不干扰该main(master)文件的情况下测试项目上的新代码? 如果您是一个小团队,并且都在同一个项目中更改不同的代码行,该怎么办?如何防止两个人更改同一行代码的错误? 这些以及更多是使用Git或版本控制可以解决的问题。

Version control is a software tool to help control the adaptations of a source code. You start with a source, then you can adapt it by making copies of it for others to work with. You can also refer to another point in time of the project, which may assist in finding certain bugs that weren’t present before. It allows you to get an idea of when the bug became present in the project.

版本控制是一种软件工具,可帮助控制源代码的改编。 您从一个源开始,然后可以通过复制它以供其他人使用来对其进行调整。 您还可以参考项目的另一个时间点,这可能有助于查找以前不存在的某些错误。 它使您可以了解该项目何时出现该错误。

Command + Z was an often used method of mine to undo everything until I got far enough to start over. Which is not a great way and can often introduce unintended removal of things that I didn’t want to. It’s fine to undo one or two things, but not practical in going back multiple steps. I didn’t know about Git or version control so I often had to restart a whole project over because I was so lost of where I was and what was wrong with the project. This caused discouragement and frustration which was not helping my iOS Development goals. But it also helped me realize what a valuable tool Git is.

Command + Z是我经常使用的方法,它可以撤消所有操作,直到我能重新开始为止。 这不是一个好方法,并且经常会意外删除我不想删除的内容。 撤消一两件事是可以的,但回退多个步骤不切实际。 我对Git或版本控制一无所知,所以我经常不得不重新启动整个项目,因为我迷失了自己的位置和问题所在。 这引起了沮丧和沮丧,这无助于我的iOS开发目标。 但这也帮助我认识到Git是有价值的工具。

Image for post

Git is the code to type in the command line or terminal of your computer to basically do all things Git related. There are a couple of commands I would like to go over just to get a general idea of how to use version control.

Git是在计算机的命令行或终端中键入的代码,基本上可以完成Git的所有相关工作。 我想通过几个命令来获得关于如何使用版本控制的一般想法。

流程 (The Process)

We first need to make a file that is a repository, this is where everything is going to take place. This can either be created on your computer for personal projects or on an online hub for teams and shareability. I’m getting familiar with the online hub of GitHub. This is by far the most popular and broadly used in businesses according to recent surveys. But to make it simple we will just talk about making one on the local computer.

我们首先需要制作一个文件,该文件是一个存储库,这就是一切的地方。 可以在您的计算机上创建个人项目,也可以在在线中心上创建团队和共享性。 我已经熟悉GitHub的在线中心。 根据最近的调查,这是迄今为止最流行且在企业中广泛使用的。 但是为了简单起见,我们将讨论在本地计算机上制作一个。

First, we create a file on let’s say the desktop. Then we open the terminal, navigate to the file and then use the commands “git init.” This initializes the file as a repository.

首先,我们在桌面上创建一个文件。 然后我们打开终端,导航到文件,然后使用命令“ git init”。 这会将文件初始化为存储库。

Image for post

To add a file to the repository you need to use “git add.”

要将文件添加到存储库,您需要使用“ git add”。

Image for post

Once you have main or what’s called a “master” file, this will not be touched until you are sure you want to change the master file. All of your changes will be done to clones of this master file which is known as a “branch.” Just like a tree, a branch comes for the trunk of the tree. The trunk being the master file and the branch is the copy that we can trim or add to. To make a branch its “git branch.”

一旦有了主文件或所谓的“主文件”,在确定要更改主文件之前,将不会触碰该文件。 您所做的所有更改都将复制到该主文件的克隆中,该克隆称为“分支”。 就像一棵树一样,树枝进入了树的树干。 主干是主文件,分支是我们可以修剪或添加到的副本。 使分支成为其“ git分支”。

Image for post

Once you have made changes to the branch, you can “commit” the changes and this makes a record of what was done so you can reference to this later if you need to go back to a previous change or commit. To commit, you guessed it, “git commit.”

对分支进行更改后,您可以“提交”更改,并记录所做的操作,以便以后需要返回到先前的更改或提交时可以参考此操作。 提交时,您猜到它是“ git commit”。

Image for post

There is a lot more functionality but these are the basics. To come full circle, say now you made all your changes and you have tested it and found no bugs and you are now ready to combine the changes done on the branch to the master file, we now need to merge the branch to the master.

还有很多功能,但这是基础。 全面介绍一下,现在说您进行了所有更改,并且已经对其进行了测试,没有发现错误,现在可以将分支上所做的更改组合到主文件中了,现在我们需要将分支合并到主文件中。

Image for post

That’s it, a very simplified explanation of version control. There are also GUI’s that make this process easier like the GitHub Desktop app to avoid typing the code. Git was developed in 2005, I couldn’t imagine working on projects, especially in teams, without it.

就是这样,这是对版本控制的非常简化的解释。 还有像GitHub Desktop app这样的GUI可以使此过程更加轻松,从而避免键入代码。 Git是2005年开发的,没有它,我无法想象可以从事项目,尤其是团队。

Rick Martinez

里克·马丁内斯(Rick Martinez)

翻译自: https://medium.com/@goodground1611/i-dont-git-it-version-control-301d0ebaa0ab

git版本控制 怎么不公开

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值