博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
git 初次提交_如何进行首次Git提交
阅读量:2521 次
发布时间:2019-05-11

本文共 4079 字,大约阅读时间需要 13 分钟。

git 初次提交

Note: This is the second video in my Git for beginners series. .

注意:这是我的Git初学者系列中的第二个视频。 。

Today we’re going to talk about how to make your first Git commit.

今天,我们将讨论如何进行首次Git提交。

If you open up Fork from , you’ll see the project screen. If you click on changes, the screen will split into two parts.

如果从来的打开Fork,您将看到项目屏幕。 如果单击更改,屏幕将分为两部分。

On the left of the screen, you’ll see a section that says unstaged files. Below this section, you’ll see another section that says staged files.

在屏幕的左侧,您会看到一个显示未暂存文件的部分。 在此部分下面,您将看到另一部分显示暂存文件的部分。

To the right, you’ll see a placeholder that shows Fork’s icon. At the bottom, you’ll see a few fields:

在右侧,您将看到一个显示Fork图标的占位符。 在底部,您将看到一些字段:

  1. A commit message field

    提交消息字段
  2. A description field

    描述字段
  3. An amended checkbox

    修改后的复选框
  4. A commit button

    提交按钮

This is called the staging area. This is where you decide what files you want to save into Git.

这称为暂存区 。 在这里,您可以决定要将哪些文件保存到Git中。

暂存文件 (Staging a file)

Before you save anything, you need to make a change in the Git repository.

在保存任何内容之前,您需要在Git存储库中进行更改。

Open up your Git project in a text editor like VS Code. Create a file called index.html and give it some HTML to start with.

在文本编辑器(如VS Code)中打开Git项目。 创建一个名为index.html的文件,并为其提供一些HTML开头。

Once you save this file, you’ll see this file in the staging area. It should appear in the unstaged files section of the staging area.

保存此文件后,您将在登台区域中看到此文件。 它应显示在暂存区域的未暂存文件部分中。

An unstaged file is a file that has been changed since you last committed into the Git repository.

自从您上次提交到Git存储库以来,未暂存的文件是已更改的文件。

If you want to commit a file (in this case, the index.html file), you can click on the file and click on stage. This file will be moved from the unstaged files section into the staged files section.

如果要提交文件(在本例中为index.html文件),则可以单击该文件,然后单击舞台。 该文件将从非暂存文件部分移至暂存文件部分。

When you have a file in the staged file section, what you’re saying is you want to save that file when you make a commit.

当您在暂存文件部分中有文件时 ,您要说的是在进行提交时要保存该文件

If you click on the file, you’ll see the lines of code (in green) that will be saved into the repository.

如果单击该文件,您将看到将保存到存储库中的代码行(绿色)。

创建一个提交 (Creating a commit)

To create a commit, you write your commit message at the bottom right corner, then click the “create commit” button.

要创建提交,请在右下角写下您的提交消息,然后单击“创建提交”按钮。

Once you click on the commit button, the staged files will disappear from the staging area. This is because the files are saved — there are no more new changes for the file in the repository.

单击提交按钮后,暂存的文件将从暂存区域中消失。 这是因为文件已保存-存储库中没有对该文件的新更改。

提交多个文件 (Committing more than one file)

You can commit many files at the same time. To do so, you need to change many files.

您可以同时提交多个文件。 为此,您需要更改许多文件。

In this example, I added a CSS file and a JavaScript file to the repository. I also added code to the index.html file to point to the CSS and JavaScript files.

在此示例中,我向存储库添加了CSS文件和JavaScript文件。 我还将代码添加到index.html文件中,以指向CSS和JavaScript文件。

If you go back into Fork now, you should see the folders and files that are changed.

如果现在回到Fork,应该会看到已更改的文件夹和文件。

To commit all three files at once, you select the files and click the stage button. Then, you write your commit message and commit the files.

要一次提交所有三个文件,请选择文件,然后单击舞台按钮。 然后,编写您的提交消息并提交文件。

检查Git历史记录 (Checking the Git History)

If you click on All Commits in the sidebar, you’ll see the commits you have made so far. In some Git clients, this is called Git History.

如果单击侧边栏中的“所有提交”,则将看到到目前为止所做的提交。 在某些Git客户端中,这称为Git历史记录。

行使 (Exercise)

Try to make a few commits into your Git repository with Fork. In the next video, I’ll show you how to push to a git remote and how to pull from a git remote.

尝试使用Fork对您的Git存储库进行一些提交。 在下一个视频中,我将向您展示如何推送到git远程以及如何从git远程拉出。

Thanks for reading. Did this article help you in any way? If I did, . You might just help someone who felt the same way you did before reading the article. Thank you.

谢谢阅读。 本文对您有任何帮助吗? 如果我 , 。 在阅读本文之前,您可能只是帮助一个感觉与您相同的人。 谢谢。

This article was originally posted at .

本文最初发布在

Sign up for my if you want more articles to help you become a better frontend developer.

如果您想获得更多文章来帮助您成为更好的前端开发人员,请注册我的 。

翻译自:

git 初次提交

转载地址:http://rbwzd.baihongyu.com/

你可能感兴趣的文章
Linux中seq命令的用法
查看>>
HTTP协议的chunked编码
查看>>
画原型是节省人力的最好办法
查看>>
shell(十)排序
查看>>
Operating System-进程间互斥的方案-保证同一时间只有一个进程进入临界区(2)- Peterson解法...
查看>>
1.1 Friday the Thirteenth
查看>>
VS 高亮显示不带后缀的C++头文件
查看>>
python基础之面向对象
查看>>
Abnormal build process termination--解决IDEA启动web项目报错
查看>>
JS设计模式之工厂模式
查看>>
Git忽略规则及.gitignore规则不生效的解决办法
查看>>
EasyUI 搜索框
查看>>
impdp and docker install oracleXE
查看>>
入门训练 序列求和
查看>>
web前端_Vue框架_设置浏览器上方的标题和图标
查看>>
gnome3 隐藏标题栏
查看>>
duilib入门简明教程 -- 第一个程序 Hello World(3) (转)
查看>>
Visual Studio 2008下载
查看>>
hdu1712: ACboy needs your help
查看>>
[30期] 贫嘴漫谈时间
查看>>