mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge pull request #20596 from lxbwolf/35-20201231-10-things-to-love-about-Git
TSL
This commit is contained in:
commit
68e89e6f3b
@ -1,88 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (lxbwolf)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (10 things to love about Git)
|
||||
[#]: via: (https://opensource.com/article/20/12/git)
|
||||
[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja)
|
||||
|
||||
10 things to love about Git
|
||||
======
|
||||
Knowing more about how Git works makes working with Git easier. Learn
|
||||
more in our readers' favorite Git articles of the year.
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
Git is an essential tool in the open source developer's toolkit. This powerful version-control system has a lot of complex features. Not all of the features are necessary to use Git, but knowing more about how Git works makes working with Git easier.
|
||||
|
||||
During 2020, Opensource.com published many excellent articles about Git, including the top 10 covered below. Each article provides tips and tricks for improving and enhancing your Git experience.
|
||||
|
||||
### How to resolve a git merge conflict
|
||||
|
||||
This tutorial by Brian Breniser begins by defining `git merge` and explaining what merge conflicts are. Then he provides a detailed tutorial about how to [work through a merge conflict][2] when one arises. Breniser also provides a few suggestions for where you can go to learn more about resolving merge conflicts and other Git functions.
|
||||
|
||||
### 4 Git scripts I can't live without
|
||||
|
||||
Vince Power shares his [most important Git scripts][3]. These scripts come from the Git Extras package, which provides over 60 scripts for enhancing Git. Power's favorite scripts are `git-ignore` for editing `.git-ignore` without opening a text editor; `git-info` for providing a summary about a Git repository; `git-mr` and `git-pr` for dealing with merge requests on GitLab and pull requests on GitHub; and `git-release`, which combines Git's `commit`, `tag`, and `push` into a single command.
|
||||
|
||||
### The life-changing magic of git rebase -i
|
||||
|
||||
Learn how to use [git rebase -i to revise your Git history][4] in this article by Dave Neary. Neary starts by explaining how Git handles the history of commits to a repository and the differences between `git commit` and `git rebase`. Next, he explains how to use `git rebase -i` to alter the history of a Git repository to make things cleaner. This allows you to move changes from "fixed typo" commits into other commits and merge similar smaller commits into combined larger commits.
|
||||
|
||||
### Make Git easy with Git Cola
|
||||
|
||||
Opensource.com editor Seth Kenlon demonstrates [how to use Git Cola][5]. Git is a command-line tool, which might turn some people off from using it. Git Cola provides a graphical interface to Git, so users who are not comfortable working on the command line can still take advantage of Git's features. In this article, Kenlon shows how to install Git Cola and accomplish many Git commit tasks using Git Cola's graphical user interface.
|
||||
|
||||
### 6 best practices for teams using Git
|
||||
|
||||
By design, Git is a collaborative tool, but many of the specifics about how to collaborate are left up to teams to decide. Ravi Chandran provides suggestions that any team could adopt [to use Git more effectively][6]. The six best practices, which Chandran explains in the article, are "formalize Git conventions," "merge changes properly," "rebase your feature branch often," "squash commits before merging," "use tags," and "make the software executable print the tag."
|
||||
|
||||
### 7 Git tricks that changed my life
|
||||
|
||||
Rajeev Bera shares [seven Git tricks][7] that improve the user experience when working with Git. The article explores Git's autocorrect option, counting commits, repo optimization, backing up untracked files, knowing the `.git` folder, viewing a file on another branch, and searching in Git.
|
||||
|
||||
### Customizing my Linux terminal with tmux and Git
|
||||
|
||||
Moshe Zadka demonstrates how he [used tmux and Git][8] to customize his Linux terminal. Zadka's article is a fascinating exploration of one person's workflow. He uses GNOME Terminal but enhances it by using tmux and features that allow him to see the status of a Git repository quickly. If files need to be committed or a commit needs to be pushed, a single letter indicates that.
|
||||
|
||||
### Make advanced Git tasks simple with Lazygit
|
||||
|
||||
Jesse Duffield explains how to use [Lazygit, a terminal interface that makes using Git easier][9]. Duffield, who developed Lazygit, details how to use the interface to stage files, rebase interactively, do cherry-picking, search through commits, and open a pull request.
|
||||
|
||||
### Managing Git projects with submodules and subtrees
|
||||
|
||||
Submodules and subtrees are two different ways to include nested subprojects in a Git repository. In [_Managing Git projects with submodules and subtrees_][10], Manaswini Das explains how the two options work and how they differ.
|
||||
|
||||
### Don't love diff? Use Meld instead
|
||||
|
||||
Ben Nuttall shows how to [use Meld instead of diff][11] to compare and merge changes. Meld is a graphical alternative to `diff` with output that is easier to understand. Nuttall demonstrates the difference between comparing two files using `diff` and Meld. He also explains how Meld is Git-aware, which means it can be used to explore changes made to a file since the last time it was committed in Git.
|
||||
|
||||
* * *
|
||||
|
||||
What do you want to learn about Git? Please share your ideas in the comments, and if you have knowledge to share, please [consider writing about it for Opensource.com][12].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/git
|
||||
|
||||
作者:[Joshua Allen Holm][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/holmja
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://opensource.com/article/20/4/git-merge-conflict
|
||||
[3]: https://opensource.com/article/20/4/git-extras
|
||||
[4]: https://opensource.com/article/20/4/git-rebase-i
|
||||
[5]: https://opensource.com/article/20/3/git-cola
|
||||
[6]: https://opensource.com/article/20/7/git-best-practices
|
||||
[7]: https://opensource.com/article/20/10/advanced-git-tips
|
||||
[8]: https://opensource.com/article/20/7/tmux-git
|
||||
[9]: https://opensource.com/article/20/3/lazygit
|
||||
[10]: https://opensource.com/article/20/5/git-submodules-subtrees
|
||||
[11]: https://opensource.com/article/20/3/meld
|
||||
[12]: https://opensource.com/how-submit-article
|
87
translated/tech/20201231 10 things to love about Git.md
Normal file
87
translated/tech/20201231 10 things to love about Git.md
Normal file
@ -0,0 +1,87 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "lxbwolf"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: subject: "10 things to love about Git"
|
||||
[#]: via: "https://opensource.com/article/20/12/git"
|
||||
[#]: author: "Joshua Allen Holm https://opensource.com/users/holmja"
|
||||
|
||||
让你爱上 Git 的 10 件事
|
||||
======
|
||||
你对 Git 了解得越多,使用 Git 就会越容易。一起来学习下年度最佳 Git 文章。
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
Git 是开源开发者工具箱中最基本的工具。这个强大的版本空值系统有很多复杂的功能。使用 Git 不需要了解它所有的功能,但是对 Git 了解得越多,使用 Git 就会越容易。
|
||||
|
||||
Opensource.com 在 2020 年发布了一些优秀的 Git 文章,其中包括下面的 top 10。每篇文章都提供了一些奇技淫巧来提升和增强你的 Git 技能。
|
||||
|
||||
### 怎么解决 git 合并时的冲突
|
||||
|
||||
Brian Breniser 的这篇教程从 `git merge` 的定义以及解释什么是冲突开始。然后他详细解释了在合并时如果有冲突[如何解决冲突][2]。Breniser 还提了一些能学习更多关于解决冲突和其他 Git 功能的建议。
|
||||
|
||||
### 我最爱的 4 个 Git 脚本
|
||||
|
||||
Vince Power 分享了他[最重要的 Git 脚本][3]。这些脚本可以从 Git Extras 包中获得,该包提供了 60 多个 Git 增强脚本。Power 最爱的脚本有:在无需打开文本编辑器的情况下编辑 `.git-ignore` 的 `git-ignore` ;用来处理 GitLab 的合并请求和 GitHub 的 PR 的`git-pr`;把 Git 的 `commit`、`tag` 和 `push` 合为一体的 `git-release`。
|
||||
|
||||
### git rebase -i 的魔力
|
||||
|
||||
在 Dave Neary 的这篇文章中可以学习[使用 git rebase -i 来修改你的 Git 提交历史][4]。Neary 从解释 Git 是如何把提交历史记录到仓库中的以及 `git commit` 和 `git rebase` 的区别。之后,他又解释了如何使用 `git rebase -i` 让 Git 仓库的提交历史变得清晰。这个命令能让你把“修复书写错误”的提交合进其他的提交里,把几个相似的小提交合并成一个大的提交。
|
||||
|
||||
### Git Cola 让使用 Git 变得简单
|
||||
|
||||
Opensource.com 的主编 Seth Kenlon 演示了[如何使用 Git Cola][5]。Git 是个命令行工具,这对于有些人来说是有学习门槛的。Git Cola 提供了一个图形界面,因此不习惯用命令行的用户也可以使用 Git。在此文中,Kenlon 展示了如何安装 Git Cola,使用 Git Cola 的图形用户界面完成了很多 Git 提交任务。
|
||||
|
||||
### 团队使用 Git 的 6 个最佳实践
|
||||
|
||||
从设计上讲,Git 是个协同工具,但是关于如何协同的很多细节是由团队自行决定的。Ravi Chandran 提了一些团队应该采用的[更高效地使用 Git][6]的一些建议。Chandran 在文中列出的 6 个最佳实践是:“使约定正式化”,“适当地合并修改”,“经常更新你的开发分支”,“在合并之前把你的提交合并成一条”,“使用标签”,“让软件的可执行程序打印标签”。
|
||||
|
||||
### 改变世界的 7 个 Git 技巧
|
||||
|
||||
Rajeev Bera 分享了 [7 个 Git 技巧][7],这些技巧能提升 Git 的用户体验。文章考察了 Git 的自动更正、提交计数、仓库优化、备份未追踪的文件、了解 `.git` 目录、在另一个分支查看文件以及在 Git 下搜索。
|
||||
|
||||
### 使用 tmux 和 Git 定制化我的 Linux 终端
|
||||
|
||||
Moshe Zadka 展示了他是如何[使用 tmux 和 Git][8]定制化他的 Linux 终端的。Zadka 的文章是个人工作流的优秀探索。他使用 GNOME 终端,用 tmux 和一些能让他快速查看 Git 仓库状态的功能来增强终端。他只需要用一个字母就可以提交文件或把提交推送到远程仓库。
|
||||
|
||||
### 使用 Lazygit 让复杂的 Git 任务简单化
|
||||
|
||||
Jesse Duffield 解释了如何使用[Lazygit,一个能让使用 Git 变得简单的终端接口][9]。Lazygit 的开发者 Duffield 详细阐述了如何使用这个接口来暂存文件、以交互方式变基、进行筛选、搜索提交以及创建一个 PR。
|
||||
|
||||
### 使用子模块和子树来管理 Git 项目
|
||||
|
||||
子模块和子树是两种在 Git 仓库中引入嵌套的子项目的方式。在[使用子模块和子树来管理 Git 项目][10]中,Manaswini Das 解释了两个选项的工作原理和区别。
|
||||
|
||||
### 不喜欢 diff?那么试试 Meld
|
||||
|
||||
Ben Nuttall 展示了如何[使用 Meld 代替 diff][11]来进行对比和合并修改。Meld 是图形化的 `diff`,输出更容易理解。Nuttall 演示了使用 `diff` 和 Mel 的进行对比的区别。他还解释了 Meld 是如何识别 Git 项目的,这意味着在 Git 中一个文件被提交之后,可以用 Meld 来搜索修改。
|
||||
|
||||
* * *
|
||||
|
||||
你想学习关于 Git 的什么内容?请在评论去分享你的想法,如果你想分享你的技能,请[考虑为 Opensource.com 投稿][12]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/git
|
||||
|
||||
作者:[Joshua Allen Holm][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[lxbwolf](https://github.com/lxbwolf)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/holmja
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF "Woman using laptop concentrating"
|
||||
[2]: https://opensource.com/article/20/4/git-merge-conflict
|
||||
[3]: https://opensource.com/article/20/4/git-extras
|
||||
[4]: https://opensource.com/article/20/4/git-rebase-i
|
||||
[5]: https://opensource.com/article/20/3/git-cola
|
||||
[6]: https://opensource.com/article/20/7/git-best-practices
|
||||
[7]: https://opensource.com/article/20/10/advanced-git-tips
|
||||
[8]: https://opensource.com/article/20/7/tmux-git
|
||||
[9]: https://opensource.com/article/20/3/lazygit
|
||||
[10]: https://opensource.com/article/20/5/git-submodules-subtrees
|
||||
[11]: https://opensource.com/article/20/3/meld
|
||||
[12]: https://opensource.com/how-submit-article
|
Loading…
Reference in New Issue
Block a user