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 短寫設置