admin管理员组

文章数量:1582678

程序员github头像

by Alyson La

由Alyson La

给新程序员的5个GitHub技巧 (5 GitHub tips for new coders)

This October I celebrated my 5 year anniversary working at GitHub. ? 5 years ago, I was an enthusiastic accountant (like straight nerd — my former twitter handle was @taxaly) who knew nothing about code, let alone about using Git and GitHub.

今年10月,我庆祝了在GitHub工作5周年。 ? 5年前,我是一位热情的会计师(像一个书呆子一样,我以前的Twitter句柄是@taxaly),对代码一无所知,更不用说使用Git和GitHub了。

Now I’m an enthusiastic Data Scientist who knows a handful of things about coding using Git & GitHub. It’s partially thanks to learning these technologies that I made this rewarding career switch.

现在,我是一位热心的数据科学家,他了解使用Git和GitHub进行编码的一些知识。 得益于学习这些技术,部分原因是我做出了这一有意义的职业转变。

But even working at GitHub, learning Git and GitHub were hard! As it’s own form of an open source contribution, I wanted to share with other folks new to coding my top 5 tips for using GitHub.

但是,即使在GitHub工作,学习Git和GitHub也非常困难! 作为开源贡献的一种形式,我想与其他刚使用GitHub编写代码的5个技巧的新手分享。

提示1:更改与Git关联的默认文本编辑器 (Tip #1: Change your default text editor associated with Git)

For many people, the default text editor when using Git from the terminal is VIM. VIM can be a terrible, scary thing for the new or casual hacker. Or even for veteran hackers or @haacked himself.

对于很多人来说,从终端使用Git时默认的文本编辑器是VIM。 对于新手或临时黑客而言,VIM可能是一件可怕的事情。 甚至对于资深的黑客或@haacked自己。

If you ever find yourself with a merge conflict (and you will, see tip #4), you’ll get kicked out to VIM to fix the conflict and then you’ll need to know the specific VIM commands to edit the doc and want to cry. For more than a year I had a sticky note on my monitor at work as a reminder of the basic VIM commands like i (to edit) and :wq (to save and quit). To avoid the potential tears, you could just change the default text editor.

如果您发现自己遇到合并冲突(您将看到提示#4),您将被踢出VIM来解决冲突,然后您需要知道特定的VIM命令来编辑文档并希望哭。 一年多来,我的显示器上有一个便条,以提醒我一些基本的VIM命令,例如i (编辑)和:wq (保存并退出)。 为避免潜在的麻烦,您可以更改默认的文本编辑器。

In order to change your text editor to Atom, Sublime, or TextMate, follow the instructions in this GitHub Help.

为了将您的文本编辑器更改为Atom,Sublime或TextMate,请遵循此GitHub帮助中的说明 。

While you are at it, you should also make sure your shortcuts are set up so you can open files in your preferred text editor directly from the terminal using subl . or atom .Check out these docs for setting up Atom access from your terminal and these docs for setting up Sublime.

在使用它时,还应确保设置了快捷方式,以便您可以使用subl .直接从终端在首选的文本编辑器中打开文件subl .atom . 查看这些文档以从您的终端设置Atom访问权限,以及这些文档以设置Sublime。

提示2: 更改您的点文件 (Tip 2: Change your dotfiles)

I didn’t learn about dotfiles until I was hacking and using Git & GitHub for multiple years. I’m still bummed that I didn’t know about this sooner!

在入侵并使用Gi​​t和GitHub多年之后,我才了解点文件。 我还是很沮丧,我不早知道这一点!

Dotfiles allow you to customize your terminal prompt so you can see what git branch you are on & if you have uncommited changes. IT’S GENIUS! I got my dotfiles from a co-worker (John Nunemaker) but if you search GitHub for ‘dotfiles’ you’ll find loads of options.

Dotfiles允许您自定义终端提示,以便查看您所在的git分支以及是否有未提交的更改。 天才! 我从同事( John Nunemaker )那里得到了我的dotfiles ,但是如果您在GitHub上搜索“ dotfiles”,则会发现很多选项。

提示3: 安装集线器 (Tip 3: Install Hub)

Hub is a command line tool that makes it easier to use GitHub. Often I will be working on a repository in my terminal but want to see issues or pull requests on GitHub. So I’ll open a browser tab, then get distracted by email/twitter/a puppy — and ten minutes later, get around to typing in the GitHub repository url.

Hub是一个命令行工具,可简化GitHub的使用。 通常,我会在终端中的存储库上工作,但希望在GitHub上查看问题或提出请求。 因此,我将打开一个浏览器选项卡,然后通过电子邮件/ twitter /一只小狗分散注意力-十分钟后,开始输入GitHub存储库URL。

By typing hub browse in the terminal, it will auto-magically open the url of the repository directly in your browser for distraction free GitHub-ing. Boom.

通过在终端中键入hub browse browser,它将直接在您的浏览器中自动神奇地打开存储库的URL,以分散免费的GitHub-ing。 繁荣。

提示4: 练习合并冲突 (Tip 4: Practice merge conflicts)

This is where I admit that I’m sometimes a quitter. Specifically when it comes to merge conflicts. I cannot remember the number of times that I’ve abandoned a project or pull request because I hit a merge conflict.

这是我承认自己有时会退出的地方。 特别是涉及合并冲突时。 我不记得因为遇到合并冲突而放弃项目或请求的次数。

They scared me, the docs on how to fix them scared me, and then I was in VIM and wanted to quit forever (see tip #1).

他们吓到我了,有关如何解决它们的文档吓到了我,然后我进入了VIM,想永远退出(请参阅提示1)。

Then I realized I needed to face my fear so I started a practice repository, created a merge conflict on purpose, and walked through the documentation or watched a YouTube video on how to fix merge conflicts. I did that a few times. Also now you can fix simple merge conflicts in the GitHub User Interface so that’s been handy.

然后,我意识到自己需要面对恐惧,因此我启动了一个练习库, 故意创建了合并冲突,然后浏览了文档或观看了有关如何解决合并冲突的YouTube视频。 我做了几次。 现在,您还可以在GitHub用户界面中解决简单的合并冲突 ,因此非常方便。

Today when I hit a merge conflict, I am slightly less scared and calmly make my way deleting the carrots, knowing that thanks to version control, I can’t mess things up too much.

今天,当我遇到合并冲突时,我有点害怕,并且冷静地删除胡萝卜,因为多亏了版本控制,我才能将事情搞得一团糟。

提示5:建立GitHub页面 (Tip #5: Make a GitHub Page)

A GitHub page is a personal or project based website that GitHub will host for free! It always helps to have an actual project to push up to GitHub to practice your Git and GitHub skills.

GitHub页面是GitHub将免费托管的基于个人或项目的网站! 拥有一个实际的项目来推动GitHub练习Git和GitHub技能总是有帮助的。

Make a simple website using HTML, CSS, and JavaScript from a coding tutorial then follow the steps to host it on GitHub here or you can check out this video I made a while back with step by step instructions. Or try the super easy Fork and Go method.

使用编码教程中HTML,CSS和JavaScript创建一个简单的网站,然后按照此处将其托管在GitHub上的步骤进行操作,或者您可以查看我之前制作的该视频,并提供逐步说明。 或尝试超级简单的Fork and Go方法。

Last, I’m gonna sneak in a 6th maybe obvious tip which is — take a Git and Github class or tutorial!

最后,我要偷偷摸摸的第6条可能显而易见的技巧- 是上Git和Github的课程或教程

Here are a few that are worth checking out:

这里有一些值得一看的地方:

  • Git-it: https://github/jlord/git-it-electron

    Git-it: https : //github/jlord/git-it-electron

  • freeCodeCamp videos: https://youtu.be/vR-y_2zWrIE

    freeCodeCamp视频: https ://youtu.be/vR-y_2zWrIE

  • GitHub Training: https://services.github/on-demand/resources/

    GitHub培训: https : //services.github/on-demand/resources/

  • Git Cheatsheet — http://ohshitgit/

    Git备忘单— http://ohshitgit/

I hope this list of tips was helpful and if you have any other tips that you found helpful in your journey to learn Git and GitHub, I’d love to hear them! ❤

我希望该提示列表对您有所帮助,并且如果您在学习Git和GitHub的过程中发现其他有用的提示,我也很乐意听到! ❤

翻译自: https://www.freecodecamp/news/5-github-tips-for-new-coders-2f312689ffd5/

程序员github头像

本文标签: 程序员头像技巧GitHub