Posted in

需要了解 Git 吗?从这里开始_AI阅读总结 — 包阅AI

包阅导读总结

1. `Git、开发者、修订控制、版本控制、工作流程`

2. 本文介绍了 Git 这一修订控制系统,包括其创建背景、重要性、基本术语、工作流程以及安装方式,指出其广泛应用但学习复杂,后续将通过实际流程展示如何使用。

3.

– Git 简介

– 是由 Linus Torvalds 于 2005 年创建

– 众多开发者和企业使用,如 GitHub 和 GitLab

– 理解 Git

– 需先理解修订控制,其用于管理文档等信息变化

– Git 是流行的修订控制系统,有本地和远程仓库

– 有分布式特点,能管理提交、分支等

– Git 术语

– 如 Pulls、Pushes、Merge、Commit 等

– Git 工作流程

– 包括安装配置、创建仓库、添加文件等步骤

– Git 适用平台

– 适用于 Linux、macOS 和 Windows,安装方式不同

思维导图:

文章地址:https://thenewstack.io/need-to-know-git-start-here/

文章来源:thenewstack.io

作者:Jack Wallen

发布时间:2024/8/23 16:52

语言:英文

总字数:934字

预计阅读时间:4分钟

评分:84分

标签:Git,版本控制,软件开发,GitHub,GitLab


以下为原文内容

本内容来源于用户推荐转载,旨在分享知识与观点,如有侵权请联系删除 联系邮箱 media@ilingban.com

If you’re a developer, you’ve probably heard of Git. If you’re not a developer or are just now starting your journey toward becoming a developer, Git might not be on your radar, but it will be.

Eventually, every developer comes in contact with Git. Even some non-developer types make use of Git. In fact, a vast number of people and organizations, from all over the globe, depend on Git.

According to Kinsta, around 100 million developers around the world use GitHub (the web service based on Git) and over 90 percent of Fortune 100 companies use the service. Over 30 million developers use a competing service, GitLab, as well. It’s nearly impossible to estimate how many people use Git itself, as many use it internally, which means any statistic would be inaccurate. Suffice it to say, Git is everywhere and you didn’t even know it.

But what is this Git thing of which I speak?

Git was created in 2005 by Linus Torvalds (the creator of Linux). According to him, there’s a lengthy history as to why he built Git, but it centers around his inability to continue using the BitKeeper revision control system.

Wait … what?

Okay, let’s back up a bit.

Understanding Git

To understand Git, you have to understand revision control because that’s at the heart of the matter. Revision control (or version control) is a system for managing changes to documents, computer programs and other types of information. Revision control is crucial to collaborative environments, especially those centered around software development.

With revision control, you can best manage changes to code (or other documents) over time. Such a system keeps track of even the smallest changes or updates that are made to the files within.

Git is one such revision control system. In fact, Git is the most popular revision control system on the market. Git works with repositories that serve as centralized hubs for everything related to a project.

Git can work with both local and remote repositories (depending on your needs). Git can manage commits, branches, merging and cloning. Git is also a distributed system, with every developer able to have a local copy of the project for offline work. Git is fast, capable of scaling, makes collaboration on a project possible, keeps track of all changes and is free to use.

Here’s the kicker: Git isn’t exactly the easiest tool to use. It’s actually fairly complex to learn, but once you understand how it functions, it becomes second nature.

Before you start working with Git, there are certain terms you’ll need to understand. Let’s dive into those terms.

Git Terms

Here are some basic terms you’ll need to know to understand Git.

Pulls

A pull is a two-step process that first pulls down changes from a remote repository and then updates your current branch with any new commits from the remote branch.

Pushes

A push is the opposite of a pull, in that it updates the remote branch with local commits. By default, a push only updates the corresponding branch on the remote. In other words, if you’ve checked out code from the main branch, any change you push will only affect that branch.

Merge

A merge is used to combine the changes from one or more branches into the current branch and integrate the history of those branches so all changes are included and all conflicts are resolved.

Commit

A commit is like a snapshot of a local repository at a specific time. Commits should be made often because they serve as the history of changes to the files within a repository.

Init

To use a repository, it must first be initialized.

Clone

To download a remote repository to a local repository, you clone it.

Origin

Origin is the name of the remote repository where you publish your commits. The default remote repository is called “origin.”

Staging Area

This is like a rough draft, where you can add new versions of a file to be saved with your next commit.

Branch

A branch is a new version of the main repository that makes it possible to work on various aspects of the project without making changes to the main branch.

The Git Workflow

Let’s now talk about how Git is used. Here’s a basic Git workflow:

  1. Install and configure Git on your local machine.
  2. Create a new repository.
  3. Add files to the repository.
  4. Commit changes.
  5. Check the status of the repository.
  6. View the commit history.
  7. Create a branch.
  8. Merge branches.
  9. Push changes to a remote repository.
  10. Pull changes from a remote repository.

Git for All

I said it wasn’t exactly the easiest tool in the shed to use. To complicate this even more, most people use Git from the command line. Yes, there are various GUIs that simplify Git usage, but the majority of developers tend to stick with the command line.

Speaking of which, Git is available for Linux, macOS and Windows. For Linux, Git is found in all the standard repositories, so installation is quite simple. For macOS, the best way to install Git is to issue the command git, which will prompt you to install the application. On Windows, download this installer and run it as you normally would any installer.

Now that you have a basic understanding of what Git is, in the next few tutorials, I’ll walk you through an actual Git workflow to show you how to set up a local repository and start working with files.

YOUTUBE.COM/THENEWSTACK

Tech moves fast, don’t miss an episode. Subscribe to our YouTubechannel to stream all our podcasts, interviews, demos, and more.

GroupCreated with Sketch.