git 短写设置
Today we’re going to talk about Git. You’re going to learn what Git is and how to set up a Git client on your computer.
今天我们将讨论Git。 您将学习什么是Git,以及如何在计算机上设置Git客户端。
什么是Git? (What is Git?)
Imagine you’re playing a game. In this game, you can create save points. When you die in the game, you need to load your game and continue from your save point.
假设您正在玩游戏。 在这个游戏中,您可以创建保存点。 当您死于游戏中时,您需要加载游戏并从保存点继续。
If you didn’t create a save point, you would start all the way at the beginning of the game again. That’s not a fun experience, so it's always a good idea to save your game.
如果未创建保存点,则将在游戏开始时重新开始。 那不是一个有趣的经历,因此保存游戏始终是个好主意。
Git is like a save point system for your work. You can create save points. In Git we call each save point a commit.
Git就像是您工作的保存点系统。 您可以创建保存点。 在Git中,我们将每个保存点称为一次提交。
When you create a commit in Git, you can load your work from that commit. If you create five commits, you can load your work from any of these commits.
在Git中创建提交时,可以从该提交中加载工作。 如果创建五个提交,则可以从任何这些提交中加载工作。
That’s what Git is for. We call it a version control system, because you can save and load your work from any commit.
这就是Git的目的。 我们称其为版本控制系统,因为您可以从任何提交中保存和加载您的工作。
选择一个Git客户 (Choosing a Git Client)
Many people teach you how to use Git with a command line, but that can be scary for beginners.
很多人教你如何在命令行中使用Git,但这对于初学者来说可能会很恐怖。
We’re going to throw away the command line and use applications to help you get started with Git. These applications are also known as Git clients.
我们将抛弃命令行,使用应用程序来帮助您开始使用Git。 这些应用程序也称为Git客户端。
My favorite Git Client is Tower. It is extremely powerful. The only downside to Tower is it costs $55.20 each year. If you’re new to programming, you might not want to start with Tower. You might want to try a free application instead.
我最喜欢的Git客户是Tower 。 它非常强大。 塔的唯一缺点是它每年花费$ 55.20。 如果您不熟悉编程,则可能不希望从Tower开始。 您可能想尝试一个免费的应用程序。
Here are some good free apps:
以下是一些不错的免费应用程序:
Sourcetree
源树
GitKraken
吉特·克拉肯
Fork
叉子
Sourcetree is probably the best free app out there. It is good and has features on par with Tower. But Sourcetree can be buggy, and you might not be able to resolve the errors yourself. (I tried, and I couldn’t).
Sourcetree可能是那里最好的免费应用程序。 很好,并且具有与Tower相当的功能。 但是Sourcetree可能有问题,您可能无法自己解决错误。 (我尝试过,但不能)。
GitKraken is another popular app that many people like. I believe GitKraken is too fancy, and focuses on the wrong things, though.
GitKraken是许多人喜欢的另一个受欢迎的应用程序。 我相信GitKraken太花哨了,尽管专注于错误的事情。
Fork looks clean and simple and is pretty good to get started with. It’s in beta right now, so its free, but you might need to pay for it later.
叉子看上去干净简单,很容易上手。 它目前处于测试阶段,因此它是免费的,但是您稍后可能需要付费。
I’m going to show you how to setup Fork.
我将向您展示如何设置Fork。
设置叉 (Setting up Fork)
Here’s the Welcome screen when you open up Fork for the first time:
首次打开Fork时,这是“欢迎”屏幕:
It will ask you for your user name and your email address. These are used for identification purposes for advanced uses when there are multiple people working on the same project.
它将询问您的用户名和电子邮件地址。 当有多个人在同一个项目上工作时,这些用于识别目的以供高级使用。
“User name” is a bit misleading, because this should be your name, not an actual username.
“用户名”有点误导,因为这应该是您的名字,而不是实际的用户名。
默认源目录 (The default source directory)
One thing I like about Fork is it asks you to set a default source directory.
我喜欢Fork的一件事是,它要求您设置默认的源目录。
This means the projects you copy (or clone) with Git will automatically go into the specified folder, which makes it easy to find.
这意味着您使用Git复制(或克隆)的项目将自动进入指定的文件夹,这很容易找到。
初始化一个Git仓库 (Initializing a Git repository)
There are two ways to create a Git repository.
有两种创建Git存储库的方法。
Before you create a Git repository, you’ll want to create a project folder in your source directory. Once you have a folder in your source directory, you can click on File
then Create new repository
in Fork to create your Git directory.
在创建Git存储库之前,您需要在源目录中创建一个项目文件夹。 一旦您的源目录中有一个文件夹,您可以单击File
然后在Fork中Create new repository
以创建您的Git目录。
To check whether the Git repository is created, you can open up the project folder and check for a .git
folder. This .git
folder is a hidden folder. You need to show your hidden files to see it.
要检查是否创建了Git存储库,可以打开项目文件夹并检查.git
文件夹。 .git
文件夹是一个隐藏的文件夹。 您需要显示隐藏文件才能看到它。
The second way to initialize a Git repository is through the command line.
初始化Git存储库的第二种方法是通过命令行。
To do so, you’d first want to create your project folder in your source directory. Then, you drag your project folder into the Terminal app. This will automatically navigate you to the project folder in the Terminal.
为此,您首先要在源目录中创建项目文件夹。 然后,将项目文件夹拖到“终端”应用程序中。 这将自动将您导航到终端中的项目文件夹。
If you want to learn more about the Terminal, I recommend starting with my article on overcoming your fear of the command line.
如果您想了解有关终端的更多信息,我建议您从克服有关命令行的恐惧的文章开始。
Once you have navigated yourself to the project folder in the terminal, you can type git init
to initialize the repository.
导航到终端中的项目文件夹后,可以键入git init
初始化存储库。
git init
结语 (Wrapping up)
Git is like a save-point system in games. You can use Git to save and load your work.
Git就像游戏中的保存点系统。 您可以使用Git保存和加载您的工作。
Thanks for reading. Did this article help you in any way? If I did, I hope you consider sharing it. You might just help someone who felt the same way you did before reading the article. Thank you.
谢谢阅读。 本文对您有任何帮助吗? 如果我愿意 , 希望您考虑与他人分享 。 在阅读本文之前,您可能只是帮助一个感觉与您相同的人。 谢谢。
This article was originally posted on my blog. Sign up for my newsletter if you want more articles to help you become a better front-end developer.
本文最初发布在我的博客上 。 如果您想要更多文章来帮助您成为更好的前端开发人员,请注册我的新闻通讯 。
翻译自: https://www.freecodecamp.org/news/how-to-set-up-a-git-client-in-just-a-few-minutes-3d78b8d2264f/
git 短写设置