linux git 学习
I recently started the third year of my undergraduate degree. I did some research regarding which skills are absolutely necessary for a developer to have.
我最近刚开始读本科三年级。 我做了一些研究,研究开发人员绝对需要哪些技能。
The answer was pretty straightforward, git and linux. Linux is an amazing operating system and git is the best version control system out there.
答案很简单, git和linux 。 Linux是一个了不起的操作系统,而git是最好的版本控制系统。
Fun fact : Git was invented by Linus Torvalds, the man behind Linux. He invented it for development of Linux kernel, with other developers contributing to its initial development.
有趣的事实:Git是Linux背后的人Linus Torvalds发明的。 他发明了用于Linux内核开发的软件,其他开发人员也为它的初始开发做出了贡献。
So, Linux and Git were 2 skills that I felt I wanted to master. Both of them were in my Bucket List of things I wish to learn. I casually procrastinated that I’d learn them. Until I came across Crio.do ….
因此,Linux和Git是我想掌握的2个技能。 他们两个都在我想学习的事物的清单清单中。 我 随便拖延要学习它们。 直到我遇到Crio.do …。
Coincidentally, they were hosting the September Edition of #IBelieveInDoing. This year their theme was Linux and Git. This felt like killing 2 birds with the same stone !
巧合的是,他们主办了#IBelieveInDoing 9月版。 今年的主题是Linux和Git。 感觉就像用同一块石头杀死两只鸟!
The first part of the program involved going through their Bytes. They are small learning modules that assist developers to learn the tech skills in an applied way. A Crio Byte includes both documentation and a codebase for a learner to work on.
该程序的第一部分涉及遍历它们的字节。 它们是小的学习模块,可帮助开发人员以应用方式学习技术技能。 Crio字节包括文档和代码库,供学习者使用。
In this case we had to go through Git Basics, Linux Basics 1 and Linux Basics 2
在这种情况下,我们必须阅读Git基础知识,Linux基础知识1和Linux基础知识2。
This byte takes us through the these things :
这个字节带我们完成了这些事情:
Getting familiar with the intimidating command line 熟悉令人恐惧的命令行 The basic commands needed to navigate through the Linux Filesystem 浏览Linux文件系统所需的基本命令 Some really interesting facts about linux. 关于linux的一些非常有趣的事实。 Redirecting input and output. 重定向输入和输出。Here are some very simple commands you could try :
您可以尝试以下一些非常简单的命令:
Prints Hello World on the terminal 在终端上打印Hello World Prints the present working directory on the terminal 在终端上打印当前的工作目录 Creates a file called 1.txt in the present working directory 在当前工作目录中创建一个名为1.txt的文件Also, this byte proceeds to explain the Linux Filesystem very nicely.
同样,该字节可以很好地解释Linux Filesystem。
Image source : https://iotbyhvm.ooo/linux-basic-commands/ 图片来源: https : //iotbyhvm.ooo/linux-basic-commands/Finally, this byte comes to an end with a small excercise in which we perform Data Analysis on huge Hadoop and OpenSSH log files using a script and some simple linux commands. Also, it explained how tasks can be automated on Linux and inspires us to use automation for repetitive tasks.
最后,该字节以一个小的练习结束,在该练习中,我们使用脚本和一些简单的linux命令对巨大的Hadoop和OpenSSH日志文件执行数据分析。 此外,它还说明了如何在Linux上自动化任务,并激发我们将自动化用于重复性任务。
This byte helps in understanding the basic git workflow. It was a competely practical and hands on approach.
该字节有助于理解基本的git工作流程。 这是一个competely 实践和动手的方法。
It started with setting up Git / Gitlab for the command line using HTTPS or SSH.
它首先使用HTTPS或SSH为命令行设置Git / Gitlab。
This byte then motivates one to experiment with the basic git commands like git clone, git add, git push, git pull.
然后这个字节激励人们尝试基本的git命令,例如git clone,git add,git push,git pull。
It also proceeded to explain what are branches and what are merge conflicts.
它还解释了什么是分支以及什么是合并冲突。
Image source: dev.to 图片来源:dev.toAt the end of this Byte, I was comfortable with using git from the command line.
在此字节的末尾,我对从命令行使用git感到很满意。
I believe this is the reason why you are reading this. So, here it goes : )
我相信这就是您阅读此书的原因。 因此,它就在这里:)
Image Source: Crio.Do 图片来源:Crio.DoAfter completing Linux Basics and Git Basics (which were already practical oriented), it was time for a hands-on project.
在完成Linux Basics和Git Basics(已经面向实际)之后,该进行动手项目了 。
My Project can be found here : https://github.com/mujtaba1747/git-autocommit
我的项目可以在这里找到: https : //github.com/mujtaba1747/git-autocommit
Here is a short video demonstration of the same :
这是相同内容的简短视频演示:
演示地址
The idea is pretty simple :
这个想法很简单:
“Linux will monitor for changes in a particular directory, when changes are detected, git commands are triggered to push them to the repository.”
“ Linux将监视特定目录中的更改,当检测到更改时,将触发git命令将其推送到存储库。”
The requirements are :
要求是:
A Linux system Linux系统 A github / gitlab or any other git based account. (Tip : Github is most popular and offers Private Repositories which only you can access) github / gitlab或任何其他基于git的帐户。 (提示:Github最受欢迎,并提供只有您可以访问的私有存储库) An internet connection (Obviously) 互联网连接(显然)Once we detect any changes using inotifywait, we trigger the git commands for pushing the changes to the repository.
一旦我们使用inotifywait检测到任何更改,就触发git命令将更改推送到存储库。
This is the bash script used in the project 这是项目中使用的bash脚本Now, you might be familiar with the git commands and the cd command. But, I’ve added > /dev/null &> /dev/null at the end of each command
现在,您可能已经熟悉git命令和cd命令了 。 但是,我在每个命令的末尾添加了> / dev / null和> / dev / null
That’s the Black Hole/Void of Linux, nothing that goes there ever returns back. I used it to prevent the script from writing any output to STDOUT and STDERR. In simpler terms, that prevented the script from displaying any output on the terminal as some git commands produce output.
那就是Linux的黑洞/虚无 ,那里没有任何东西可以返回。 我用它来防止脚本将任何输出写入STDOUT和STDERR。 简而言之,由于某些git命令产生输出,这阻止了脚本在终端上显示任何输出。
You can read more about it here : STDERR, STDIN and STDOUT and also What is /dev/null in Linux.
您可以在这里阅读有关它的更多信息: STDERR,STDIN和STDOUT,以及Linux中的/ dev / null 。
23286 is the Process ID of the script. You can find the same by running ps aux | grep “watch.sh” 23286是脚本的进程ID。 您可以通过运行ps aux找到相同的内容。 grep“ watch.sh”Also, when launching the script, you have add & (ampersand) to make it run in the background, otherwise the script stops as soon as you exit the command line or press Ctrl + C.
另外,启动脚本时,您需要添加&(与号)以使其在后台运行,否则,一旦退出命令行或按Ctrl + C,脚本便会停止。
There are few more technical details for which, you can head to my repository on github : https://github.com/mujtaba1747/git-autocommit
还有一些其他的技术细节,您可以转到我在github上的存储库: https : //github.com/mujtaba1747/git-autocommit
It’s feasible to build a simple service for Linux that’ll watch a directory for changes and push those changes to the cloud in real time. Now, in my case I used a Linux System Call (inotifywait) and git to implement the same.
为Linux构建简单的服务是可行的,该服务将监视目录中的更改并将这些更改实时推送到云中。 现在,以我为例,我使用Linux系统调用(inotifywait)和git来实现它们。
The courses are designed in such a manner that even difficult / scary concepts are slowly explained in a simple and lucid manner, along with practical tasks. Apart from their learn by doing approach, the best part about the Bytes was that each part had a curious cats section, which had insightful questions whose answers weren’t present in the Byte. That leaves the learner yearning for more knowledge and thus, he/she looks elsewhere for more. Personally I found the curious cats section at the end of each milestone really helpful in this Journey.
这些课程的设计方式是,即使是困难/可怕的概念,也要以简单明了的方式慢慢地加以解释,并附有实际任务。 除了他们的“边做边学”方法外,有关字节的最好的部分是每个部分都有一个好奇的猫部分,其中有一些有见地的问题,而答案没有出现在字节中。 这使学习者渴望获得更多的知识,因此,他/她在其他地方寻求更多的知识。 我个人觉得每个里程碑末尾的好奇猫部分对本次旅程都非常有帮助。
Also, all the Bytes I mentioned are freely available at : Crio.do
另外,我提到的所有字节都可以从以下位置免费获得 : Crio.do
You can sign up for the upcoming #IBelieveInDoing Hacktoberfest Edition at : https://crio.do/IBelieveInDoing/October/
您可以在以下网址注册即将发布的#IBelieveInDoing Hacktoberfest Edition : https : //crio.do/IBelieveInDoing/October/
In this 14-days event, you will get started with your first Open Source Pull Request while building your own Crio bytes for the developer community.
在这14天的活动中,您将开始第一个开源请求请求,同时为开发人员社区构建自己的Crio字节。
#IBelieveInDoing #IBelieveInDoingKeep Learning,
保持学习,
Syed Mujtaba
赛义德·穆塔巴(Syed Mujtaba)
翻译自: https://medium.com/@mujtaba1747/how-to-learn-linux-and-git-25b18a815778
linux git 学习