mac azure git

This article gives an insight into the terms in the Git repository of Azure Data Studio. In the previous articles, we learned the following things:

本文深入介绍了Azure Data Studio的Git存储库中的术语。 在前面的文章中,我们了解了以下内容:

  • Source Control using Git in Azure Data Studio (ADS) 在Azure Data Studio(ADS)中使用Git进行源代码控制

    • Introduction, overview, installation, and integration of Git in ADS 在ADS中介绍,概述,安装和集成Git
    • Initiate the repository, commit changes, and view timeline. 启动存储库,提交更改并查看时间轴。
  • Integrating Azure Data Studio with Git and GitHub 将Azure Data Studio与Git和GitHub集成
    • Comparison of Git and GitHub repositories Git和GitHub存储库的比较
    • Create GitHub repository, Integrate GitHub and Git using Azure Data Studio 创建GitHub存储库,使用Azure Data Studio集成GitHub和Git
    • Bidirectional commit 双向提交
    • View script changes 查看脚本更改

As you know, Git provides a version control system to track changes in your scripts. It is a shared repository in which team members can view, modify, and commit their changes. It is useful to know the components of Git repositories.

如您所知,Git提供了一个版本控制系统来跟踪脚本中的更改。 它是一个共享的存储库,团队成员可以在其中查看,修改和提交其更改。 了解Git存储库的组件很有用。

Git存储库组件和工作流程 (Git repositories components and workflow)

It has three main components – Working directory, staging area, and local repository. In the below screenshot, it shows all changes move from the Working directory -> Staging area-> Local repository.

它具有三个主要组件– 工作目录,暂存区本地存储库 。 在下面的屏幕快照中,它显示了所有从工作目录->暂存区域->本地存储库更改

Let’s explore these areas in detail.

让我们详细探讨这些领域。

工作目录或树 (The Working directory or tree)

It is the area where our scripts exist. In Git, we can also call it an untracked area. It means that if you make any changes in your script, Git marks them in the Working tree but do not explicitly save it. You may lose your changes at this point because Git is not tracking your changes. We need to instruct Git to track and save these changes.

这是我们的脚本存在的区域。 在Git中,我们也可以将其称为未跟踪区域。 这意味着,如果您在脚本中进行了任何更改,Git都会在工作树中将其标记出来,但不会显式保存。 此时您可能会丢失更改,因为Git尚未跟踪您的更改。 我们需要指示Git跟踪并保存这些更改。

In the Azure Data Studio, open the integrated terminal for PowerShell commands. In this terminal, run the command Git Status.

在Azure Data Studio中,打开PowerShell命令的集成终端。 在此终端中,运行命令Git Status。

In the output, you get a message nothing to commit, working tree clean.

在输出中,您没有得到任何消息可提交,工作树干净了。

It shows that Git does not have any tracked file that is being modified. It also tells you about the Git branch. By default, Git uses the master branch.

它显示Git没有任何正在修改的跟踪文件。 它还告诉您有关Git分支的信息。 默认情况下,Git使用master分支。

Now, add a new script in the repository folder we initiated earlier. Rerun the git status command. It is a new file that does not exist before the last commit. It is an untracked file, so in the output of git status, it gives you information for the untracked files as well. Git does not automatically include in the commit snapshots.

现在,在我们先前启动的存储库文件夹中添加一个新脚本。 重新运行git status命令。 这是一个新文件,在上一次提交之前不存在。 这是一个未跟踪的文件,因此在git status的输出中,它也为您提供了未跟踪的文件的信息。 Git不会自动包含在提交快照中。

暂存区 (Staging area)

Git starts tracking the files in the staging area. As per the above screenshot, it instructs you to run the Git add command to move the file from the working tree to the staging area. Git does not track any additional changes to these files after you added into the staging area. It requires an explicit notice to Git.

Git开始跟踪暂存区域中的文件。 按照上面的屏幕截图,它指示您运行Git add命令将文件从工作树移动到暂存区。 添加到暂存区域后,Git不会跟踪对这些文件的任何其他更改。 它需要明确通知Git。

Let’s add the file into the staging area using the below command.

让我们使用以下命令将文件添加到暂存区域。

git add “filename”

git添加“文件名”

You need to specify the file name in double-quotes, or else it won’t add the files. Once you add the file, notice that Git shows the file under the staged changes.

您需要在双引号中指定文件名,否则它不会添加文件。 添加文件后,请注意,Git在分阶段的更改下显示了该文件。

Hover the mouse over icon A, and you get index added message in the pop-up.

将鼠标悬停在图标A上,您会在弹出窗口中看到添加索引的消息。

Rerun the git status command. It shows the changes that need to be committed. Git now tracks the file in the staged area.

重新运行git status命令。 它显示了需要提交的更改。 Git现在在暂存区域中跟踪文件。

Let’s modify this file that is in the staging area but not yet committed. I added the highlighted line and made some errors in this script knowingly. It immediately shows the number of errors in this file.

让我们修改暂存区域中但尚未提交的文件。 我添加了突出显示的行,并故意在此脚本中犯了一些错误。 它立即显示此文件中的错误数。

Modify the script to remove any syntax errors. You do not see the number of errors now in the below screenshot.

修改脚本以删除任何语法错误。 在下面的屏幕快照中,您现在看不到错误数量。

Save your changes and check the output of git status. You see two entries for the same file.

保存更改并检查git status的输出。 您会看到同一文件的两个条目。

所做更改: (Changes to be committed:)

It is the file version we moved from the working tree to the staged area.

这是我们从工作树移动到暂存区的文件版本。

更改未上演以提交 (Changes not staged for commit )

We modified the file in the staged area. Git does not track the changes in the staged area until we explicitly ask Git to do so.

我们在暂存区中修改了文件。 在我们明确要求Git这样做之前,Git不会跟踪工作区中的更改。

We can run again the Git add command to move the changes as well from the working tree to the staged area.

我们可以再次运行Git add命令,将更改也从工作树移动到暂存区域。

Now, in the git status command output, you get the only row for the changes to be committed. It is the tracked version of the script.

现在,在git status命令输出中,您仅获得要提交的更改的行。 它是脚本的跟踪版本。

查看未上演的更改 (View the changes that are not staged )

Suppose we want to view the changes that are not staged yet. We performed the changes in the working tree area.

假设我们要查看尚未上演的更改。 我们在工作树区域中进行了更改。

For this purpose, we can use command git diff without any arguments. Git diff command compares the working directory and staging area files. In the below screenshot, we removed a line from the script in the working area. The staged copy of this file has this line added. Therefore, we get the difference in these scripts as the changes not staged.

为此,我们可以使用不带任何参数的git diff命令。 Git diff命令比较工作目录和暂存区文件。 在下面的屏幕截图中,我们在工作区的脚本中删除了一行。 此文件的暂存副本已添加此行。 因此,由于未进行更改,因此我们在这些脚本中得到了不同。

Similarly, we can use argument –staged in the git diff command to view staged changes that will go in the next commit.

同样,我们可以在git diff命令中使用–staged参数来查看将在下一次提交中进行的分段更改。

本地存储库 (The Local Repository)

The local repository contains the version of the file after you performed a commit operation. It is the final version that is saved in the Git. You can move the items from the staging area to the local repository using the git commit command. In the Azure Data Studio, you can also use Command Palette -> Git commit for this purpose.

执行提交操作后,本地存储库包含文件的版本。 它是保存在Git中的最终版本。 您可以使用git commit命令将项目从登台区域移动到本地存储库。 在Azure Data Studio中,您也可以为此使用Command Palette-> Git commit

This command gathers all changes in the staging area tracked) and puts them in the local repository. A commit command is similar to a Checkpoint command in SQL Server. Once it moved the changes to the local repository, you do not see any item in the staging area.

此命令将在跟踪的暂存区域中收集所有更改,并将它们放入本地存储库中。 提交命令类似于SQL Server中的Checkpoint命令。 将更改移到本地存储库后,您在暂存区域中看不到任何项目。

Execute the git command in the terminal, and it opens the following window. You need to enter the commit message in this window.

在终端中执行git命令,它将打开以下窗口。 您需要在此窗口中输入提交消息。

To insert the commit message, press I and enter. It changes the prompt to Insert, as shown below.

要插入提交消息,请按I并输入。 它将提示更改为插入,如下所示。

Use arrow keys to take the cursor to a specific position and enter your commit message.

使用箭头键将光标移至特定位置,然后输入提交消息。

To save this file, press ESC followed by wq. WQ stands for write and quit.

要保存此文件,请按ESC,然后按wq 。 WQ代表写和退出。

After the commit, check the output of the git status command. It says that your branch is ahead of ‘Rajendra/master’ by 1 commit.

提交后,检查git status命令的输出。 它说您的分支比“ Rajendra / master”要早1次提交。

In the previous article, we integrated the GitHub cloud-based repository without the Git repository in the Azure data studio. Git commit performs the commit in the local repository. It does not sync it with the GitHub repository.

在上一篇文章中,我们在Azure数据工作室中集成了基于GitHub云的存储库,而没有Git存储库。 Git commit在本地存储库中执行提交。 它不会与GitHub存储库同步。

To verify it, open the GitHub repository and check the actual items. In this article, we added a new file, “SERVERPROPERTY Resource DB.sql”, but it is not available in the GitHub as shown below.

要验证它,请打开GitHub存储库并检查实际项目。 在本文中,我们添加了一个新文件“ SERVERPROPERTY Resource DB.sql”,但该文件在GitHub中不可用,如下所示。

We have already linked Git repository with GitHub, but it is not in sync; that’s why we get the message – your branch is ahead by 1 commit.

我们已经将Git存储库与GitHub链接了,但是它不是同步的。 这就是我们收到消息的原因-您的分支比1次提交领先。

We can either use Azure Data Studio command palette – > Git Sync or use the command git push for it. It compares the Git local repository and GitHub repository and starts synchronization. It does not take sync any changes from the Git working tree or stage area.

我们可以使用Azure Data Studio 命令面板–> Git Sync,也可以使用命令git push 。 它比较Git本地存储库和GitHub存储库并开始同步。 它不会同步来自Git工作树或舞台区域的任何更改。

Refresh the GitHub web browser, and you get the additional file that we used in this article. It also shows the commit message we inserted earlier.

刷新GitHub Web浏览器,您将获得本文中使用的其他文件。 它还显示了我们之前插入的提交消息。

Click on the file name and view its content.

单击文件名并查看其内容。

Let’s go back to the Azure Data Studio terminal and run git status. It still shows a change not staged for commit. Previously, we removed a line in the working tree but did not move the change to the staged area. It is still in the working tree, although we performed the git commit activity.

让我们回到Azure Data Studio终端并运行git status。 它仍然显示未上演提交的更改。 以前,我们在工作树中删除了一条线,但没有将更改移到暂存区域。 尽管我们执行了git commit活动,它仍然在工作树中。

To commit this change, do the following steps

要提交此更改,请执行以下步骤

  • Run a git add “filename” command 运行git add“文件名”命令
  • Run a git commit command and specify a commit message 运行git commit命令并指定提交消息
  • Run a git push command to sync changes with the GitHub repository 运行git push命令以将更改与GitHub存储库同步

Now, you can see the updated commit message in GitHub.

现在,您可以在GitHub中查看更新的提交消息。

The script in GitHub is also modified to reflect the last commit.

GitHub中的脚本也被修改以反映最后的提交。

Now, in the git status, it shows the message – nothing to commit, working tree clean.

现在,在git状态下,它会显示消息-无需提交,工作树将清除。

We completed the cycle of moving the changes from Working tree-> staged area-> local repository -> GitHub

我们完成了将更改从工作树->暂存区域->本地存储库-> GitHub移出的周期

结论 (Conclusion)

In this article, we explored the useful components of Git – Working tree, Staging area, and repository. We learned the lifecycle of items moving through these components and synchronization with GitHub using Git commands. I hope it gives you get a good understanding of git integration in Azure Data Studio. Stay tuned to learn more about Git in my upcoming articles.

在本文中,我们探讨了Git的有用组件- 工作树暂存区存储库 。 我们了解了项目在这些组件中移动以及使用Git命令与GitHub同步的生命周期。 我希望它能使您对Azure Data Studio中的git集成有很好的了解。 请继续关注我的后续文章,以了解有关Git的更多信息。

目录 (Table of contents)

The SQL Server Assessment Extension for Azure Data Studio
Source Control using Git in Azure Data Studio (ADS)
Integrating Azure Data Studio with Git and GitHub
Working with Git components in Azure Data Studio
适用于Azure Data StudioSQL Server评估扩展
在Azure Data Studio(ADS)中使用Git进行源代码控制
将Azure Data Studio与Git和GitHub集成
在Azure Data Studio中使用Git组件

翻译自: https://www.sqlshack.com/working-with-git-components-in-azure-data-studio/

mac azure git

mac azure git_在Azure Data Studio中使用Git组件相关推荐

  1. azure云数据库_Azure Data Studio中Windows的数据库管理工具扩展

    azure云数据库 Azure Data Studio provides a modern and productive experience for managing on-premise and ...

  2. azure云数据库_Azure Data Studio中的服务器和数据库仪表板

    azure云数据库 Azure Data Studio (ADS) is an integrated, lightweight database development for supporting ...

  3. mac azure git_将Azure Data Studio与Git和GitHub集成

    mac azure git In the last article, Source Control using Git in Azure Data Studio (ADS), we explored ...

  4. sql azure 语法_Azure Data Studio中SQL代码段

    sql azure 语法 This article will fully cover the code snippet SQL developer productivity feature in Az ...

  5. sql azure 语法_Azure Data Studio中SQL Server Profiler

    sql azure 语法 In this article, we will explore SQL Server Profiler in Azure Data Studio in detail inc ...

  6. 在Azure Data Studio中查看执行计划

    This article gives an overview of viewing execution plans in the Azure Data Studio. 本文概述了在Azure Data ...

  7. sql azure 语法_在Azure Data Studio中计划SQL笔记本

    sql azure 语法 SQL Notebooks are an interactive way of creating documents, executing T-SQL queries alo ...

  8. sql azure 语法_Azure Data Studio中SQL Server架构比较扩展

    sql azure 语法 This article explores the SQL Server Schema Compare extension in the Azure Data Studio. ...

  9. sql azure 语法_在Azure Data Studio中学习用于SQL Notebook的Markdown语言

    sql azure 语法 Microsoft supports SQL Notebooks in Azure Data Studio. It is an exciting feature that a ...

最新文章

  1. 图论 ---- F. Useful Edges(不等式移项优化预处理 + 路径和简单路径的区别 + 最短路)
  2. 搞定“另一个 OleDbParameterCollection 中已包含 OleDbParameter。”的两种办法。
  3. 事件标志组解决任务间资源共享问题
  4. 计算机系统基础:设备管理知识笔记
  5. React开发(161):onref绑定
  6. linux nginx完全卸载
  7. 几点减几点怎么列算式_节日礼品怎么挑选 这几点很关键
  8. Java B2B2C o2o多用户商城 springcloud架构-docker-feign-hystrix(六)
  9. Problem B: 取石子
  10. 约数定理和分解质因数
  11. 基于单片机的功放protues_基于单片机的音乐播放器设计
  12. Java IO 和 NIO的区别
  13. latex图表中英文双标题的使用技巧
  14. 『单片机原理』程序存储器的结构
  15. 活久见:都 2203 年了,你还在使用 word 调试 API
  16. 武汉大学研究生慕课《学术道德与学术规范》
  17. BoardCast广播组件
  18. JavaScript 获取字符串的最后一个字符
  19. 1-09 C基础 (多文件编译)
  20. 计算机术语桢什么意思,120桢什么意思

热门文章

  1. output怎么用_这个功能QQ音乐,网易云音乐都有——用python实现一个音乐检索器...
  2. linux有名管道 复用,关于LINUX有名管道的多路复用有关问题
  3. Java抽象类、接口和内部类
  4. 20190703 日子
  5. 18、OpenCV Python 简单实现一个图片生成(类似抖音生成字母人像)
  6. 培生同意以3亿美元出售华尔街英语
  7. 虚拟地球原理与实现(转载)
  8. 计算机网络学习笔记(15. OSI参考模型③、TCP/IP参考模型)
  9. 苹果公司为什么不给iPhone设计大容量电池和快充?
  10. 怎么用手机查看WiFi密码?