Git 都 15 岁了，如何入门或学习点新东西
Git

> 
> 在 Git 15 周年之际，了解为什么 Git 是保持软件行业运行的重要组成部分。
> 
> 
> 


![](/data/attachment/album/202004/13/091410k80er3mttrznc22e.jpg)


如果说过去二十年来有什么东西改变了软件，那么 [Git](https://en.wikipedia.org/wiki/Git) 肯定位列榜首。


如果你没有亲自使用过 Git，你可能会认为它只是一种技术时尚，只是因为它是由 [Linux](https://opensource.com/resources/linux) 项目的创始人创建的，所以在开发者中只是一个偶然的宠儿。这或许有一定的道理，但 Git 确实取得了一些其他行业所没有的成就。有了 Git，分布在世界各地的开发者们可以在同一时间对同一段代码进行工作，并记录下每一次修改的历史，然后将所有的工作合并到一起，形成一个成品。由于这件事情非常复杂，所以这个工具本身也会变得很复杂，但归根结底，它是维持软件行业运行的重要组成部分。


无论你是否了解 Git，如果你足够深入的研究开源软件，或者进入计算机科学领域，都有可能遇到它。无论你使用 Git 只是为了下载一个安装包，还是每天与它交互来管理代码，了解更多关于它的知识，都会对你有很大的启发和帮助。


### Git 术语


与任何专业工具一样，Git 中也有很多行话。像“<ruby> 克隆 <rt>  clone </rt></ruby>”、“<ruby> 合并 <rt>  merge </rt></ruby>”和“<ruby> 变基 <rt>  rebase </rt></ruby>”这样的术语，最起码也是神秘的，而更糟的情况下会令人感到排斥。试图理解这些术语的含义可能会让人不知所措，但如果你从 Matthew Broberg 的优秀文章《[Git 术语基础](https://opensource.com/article/19/2/git-terminology)》中得到一点指导，就不会这样了。只需快速阅读一下，你就能真正理解地听懂关于 Git 的对话。


### Git 入门


如果你需要知道如何使用 Git，那么我自己的[关于使用 Git 的入门文章系列](https://opensource.com/life/16/7/stumbling-git)是一个很好的开始。这些文章已经有几年的历史了，但就像许多 Linux 和 UNIX 技术一样，它的界面并没有发生很大的变化，所以这些文章和我写这些文章那时一样，在今天还是很有意义的。这一系列文章向你介绍了 Git 最基本的概念，并带领你完成创建仓库、提交文件、恢复文件、合并分支等过程。


### 常见的 Git 服务


Git 最常见的用途之一是公共的 Git 托管服务，比如 GitLab 和 GitHub。Kedar Vijay Kulkarni 在他的《[如何在 Git 中克隆、修改、添加和删除文件](https://opensource.com/article/18/2/how-clone-modify-add-delete-git-files)》一文中，演示了大多数开发者使用 Git 执行的日常任务。这不是非开发者的必读书目，但对于任何想在公共 Git 托管服务上为项目做贡献的人来说，这篇文章是必读的。这篇文章专门针对的是 Github，因为它是当今最常见的平台之一，但其原理也适用于任何 Git 服务的 Web 前端，包括 [GitLab](https://about.gitlab.com/install/)、[Gogs](https://gogs.io/) 和 [Gitea](https://gitea.io/en-us/) 等流行的开源框架。


### 试试这个 Git 演练


与其漫无目的的探索，你是不是更喜欢在导游的带领下学习？有时候，学习一件事最简单的方法就是模仿别人的准确步骤。你知道最终的结果是肯定成功的，所以你在进行练习的时候会有信心，而你的大脑和手指也会得到重复的好处，从而建立起记忆。如果这是你的学习风格，那就跟着 Alan Formy-Duvall 的《[Git 的实用学习练习](https://opensource.com/article/19/5/practical-learning-exercise-git)》，找出成功的 Git 课程的感觉。


### Git 应用程序


信不信由你，Git 的界面比你在终端输入的文字更多。显然，在线托管的 Git 有 Web 界面，但是你也可以在计算机上使用 Git 客户端。如果想获得更多的帮助，请阅读 Jesse Duffield 关于 [Lazygit](https://opensource.com/article/20/3/lazygit) 的文章或 Olaf Anders 关于 [Tig](https://opensource.com/article/19/6/what-tig) 的文章。要获得完整的图形应用程序体验，请阅读我有关 [Git-cola](https://opensource.com/article/20/3/git-cola)、[Sparkleshare](https://opensource.com/article/19/4/file-sharing-git) 以及[其它应用](https://opensource.com/life/16/8/graphical-tools-git)的文章。是的，甚至还有[用于你的移动设备的界面](https://opensource.com/article/19/4/calendar-git#mobile)！


### 了解更多关于 Git 的信息


知识就是力量，所以不要让 Git 对你来说像个谜。无论你是直接使用它，还是只知道它的名字，或者你以前从未听说过它，现在都是了解 Git 的好时机。这里有很多资源可以帮助你了解它的工作原理、工作原理以及人们为什么这么喜欢它。潜入其中，按照自己的节奏来学习，并学会爱上 Git 吧！




---


via: <https://opensource.com/article/20/4/get-started-git>


作者：[Seth Kenlon](https://opensource.com/users/seth) 选题：[lujun9972](https://github.com/lujun9972) 译者：[wxy](https://github.com/wxy) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
If there's anything that's changed software in the past two decades, [Git](https://en.wikipedia.org/wiki/Git) is at the top of the list.

If you don't use Git personally, you might think it's just a tech fad, an incidental darling among developers just because it was created by the same person who started the [Linux](https://opensource.com/resources/linux) project itself. There may be some truth to that, but Git does manage to achieve some feats that no other industry has managed. With Git, developers spread all over the world are able to work on the same code, literally at the same time, with a history of every change made, and then merge all the work together to result in a finished product. The complexity is enormous, and so the tool itself can get complex, but in the end, it's a major component in keeping the software industry running.

Whether you know Git or not, you'll very likely encounter it should you dig deep enough into open source software or enter into computer science. Whether you use Git to just download an installer package or whether you interface with it daily to manage code, learning more about it is elucidating and empowering.

## Git terminology

As with any specialized tool, there's a lot of jargon in Git. Terms like "clone" and "merge" and "rebase" are mysterious at best, and at worst can feel almost exclusionary. Trying to understand what all of these terms mean can be overwhelming, but not if you take a little guidance from Matthew Broberg's excellent [Git Terminology 101](https://opensource.com/article/19/2/git-terminology) article. In just one quick read, you'll be able to listen in on conversations about Git with real comprehension.

## Getting started with Git

If you need to know how to use Git, then my own [introductory article series about using Git](https://opensource.com/life/16/7/stumbling-git) is a great place to start. The articles are several years old now, but as with so many Linux and UNIX technologies, the interface hasn't changed significantly, so the articles are as relevant today as they were when I wrote them. The series introduces you to the most basic concepts of Git, and steps you through the process of creating a repository, committing files, restoring files, merging branches, and much more.

## Common Git services

One of the most common uses of Git is a public Git hosting service, such as GitLab and GitHub. In his [How to clone, modify, add, and delete files in Git](https://opensource.com/article/18/2/how-clone-modify-add-delete-git-files) article, Kedar Vijay Kulkarni demonstrates the everyday tasks most developers perform with Git. This isn't required reading for non-developers, but it's a must for anyone who wants to contribute to a project on a public Git hosting service. This article addresses Github specifically because it's one of the most common platforms today, but the principles apply to any web front-end for Git, including popular open source frameworks like [GitLab](https://about.gitlab.com/install/), [Gogs](https://gogs.io/), and [Gitea](https://gitea.io/en-us/).

## Try this Git walkthrough

Do you prefer a guided tour to aimless exploration? Sometimes the easiest way to learn something is to mimic someone else's exact steps. You know the end result is a guaranteed success, so you have confidence while performing the exercise, and your brain and fingers get the benefit of repetition, which builds memory. If that's your learning style, then follow along with Alan Formy-Duvall's [practical learning exercise for Git](https://opensource.com/article/19/5/practical-learning-exercise-git) and find out what a successful Git session feels like.

## Git apps

Believe it or not, Git has more interfaces than text you type into a terminal. Obviously there are the web interfaces of Git hosts online, but you can use Git clients on your computer, too. For just a light layer of assistance, read Jesse Duffield's article about [Lazygit](https://opensource.com/article/20/3/lazygit) or Olaf Anders' article about [Tig](https://opensource.com/article/19/6/what-tig). For the full graphical application experience, read my article about [Git-cola](https://opensource.com/article/20/3/git-cola), [Sparkleshare](https://opensource.com/article/19/4/file-sharing-git), and [still others](https://opensource.com/life/16/8/graphical-tools-git). And yes, there are even [interfaces for your mobile devices](https://opensource.com/article/19/4/calendar-git#mobile)!

## Learn more about Git

Knowledge is power, so don't let Git be a mystery to you. Whether you use it directly or you only know it by name or you'd never heard of it before, now's a great time to learn about Git. There are great resources out there to help you understand how it works, why it works, and why people love it so much. Dive in, take it at your own pace, and learn to love Git!

## 2 Comments