git .git目录提交

I use Git every day and I wrote a Git guide and a Git Cheat Sheet in the past.

我每天都使用Git,过去我写过Git指南和Git备忘单 。

I consider myself a Git fan, but …I’m not an expert of Git.

我认为自己是Git的粉丝,但是...我不是Git的专家。

Commit, fetch origin, pull origin, push to origin.. that’s my day-to-day of using Git.

提交,获取原点,拉原点,压入原点..这就是我每天使用Git的时间。

And I do some Git:

我做一些 Git:

The advanced things that Git can do blow my mind. It can be very complex, and I tend to avoid all that complexity. I almost never use Git in the command line, and use GitHub Desktop which is the simplest and nicest Git client ever.

Git可以做的高级事情让我震惊。 它可能非常复杂,我倾向于避免所有这些复杂性。 我几乎从不在命令行中使用Git,而使用GitHub Desktop ,这是有史以来最简单,最出色的Git客户端。

Two things I do however use sometimes are cherry-picking and squashing commits.

但是,有时候我要做的两件事是摘樱桃和压榨提交

Let’s talk about that.

让我们来谈谈。

In projects where I’m the only developer, which means all my personal projects, I do tend to work on master when I can. For example if I’m doing a simple change, or adding a new post to the blog. Fast and non-breaking stuff.

在我是唯一开发人员的项目中,这意味着我所有的个人项目,我都会在可能的情况下倾向于使用master。 例如,如果我要进行简单的更改,或者将新帖子添加到博客中。 快速且不间断的东西。

In some cases however I do not use this approach, and instead I create a branch for a big feature.

但是,在某些情况下,我不使用这种方法,而是为大型功能创建分支。

This is also the default when working on a team-based or open source project.

这也是基于团队或开源项目工作时的默认设置。

You create a branch, and commit often. Committing early and often is a great advantage because you can work on your code with the confidence that you can always return back to a working state, or at least to a state you know that something worked.

您创建一个分支,并经常提交。 尽早且经常进行提交是一个很大的优势,因为您可以放心地编写代码,使您始终可以返回到工作状态,或者至少返回到您知道某些工作有效的状态。

You might do a series of quick commits where the message is “ok”, “trying this”, or “fix dumb mistake”.

您可能会执行一系列快速提交,其中消息是“确定”,“尝试执行此操作”或“修复愚蠢的错误”。

But at some point you need to converge to a stable state and commit the changes back to master, or to any branch you want.

但是在某些时候,您需要收敛到稳定状态并将更改提交回master或您想要的任何分支。

You want to do one thing before that: squashing your commits.

在此之前,您想做一件事:压缩提交。

GitHub can do that for you automatically when you are merging a Pull Request, and it’s a workflow I’ve been using a lot on public Open Source repositories in the past.

合并合并请求请求时, GitHub可以自动为您执行此操作,这是我过去在公共开放源代码存储库中经常使用的工作流程。

Instead of seeing all the individual commits contained in a Pull Request, you only see one commit, and in the PR merge process you can write a detailed and dedicated commit message and description.

您只看到一个提交,而不是看到“拉取请求”中包含的所有单个提交,在PR合并过程中,您可以编写详细的专用提交消息和描述。

This will eliminate all the previous Git commits that diverge from the head of the branch you’re merging to, and also remove all those commits where maybe you reverted changes, and so on.

这将消除所有先前与合并分支的分支不同的Git提交,并删除所有您可能还原了更改的提交,依此类推。

This is squashing in the GitHub PR process. You can squash your commits outside of GitHub, too.

这正在压榨GitHub PR流程。 您也可以在GitHub之外压缩提交。

Once your work on a branch is done, you merge master (or any other branch where you want to merge) into it:

在分支上完成工作后,将母版(或您要合并的任何其他分支)合并到其中:

git merge master

so you can handle any update conflict there.

因此您可以在那里处理任何更新冲突。

Then you checkout master, and from there you run:

然后您检出master,然后从那里运行:

git merge --squash <your-feature-branch>

and then

然后

git commit

This is just one of the possible workflows you can use, and doing all using GitHub is very simple and the option that can give you the least amount of headaches.

这只是您可以使用的可能工作流程之一,并且使用GitHub完成所有工作非常简单,并且该选项可以使您头疼最少。

翻译自: https://flaviocopes.com/git-squash/

git .git目录提交

git .git目录提交_压扁Git提交相关推荐

  1. git 命令详解_再次学习Git版本控制工具

    微信公众号:PHP在线 Git 究竟是怎样的一个系统呢?为什么在SVN作为版本控制工具已经非常流行的时候,还有Git这样一个版本控制工具呢?Git和SVN的区别在哪儿呢?Git优势又在哪呢?下面PHP ...

  2. git reset 怎么还原_如何在Git中重置、恢复,返回到以前的状态

    编辑推荐: 本文来自51cto,在本文中,我们将带你了解如何去重置.恢复和完全回到以前的状态,做到这些只需要几个简单而优雅的 Git 命令. 用简洁而优雅的 Git 命令撤销仓库中的改变. 使用 Gi ...

  3. git钩子放服务器_如何使用Git 钩子来自动化开发和部署任务

    介绍 版本控制已成为现代软件开发的中心要求. 它允许项目安全地跟踪更改,启用撤销,完整性检查和协作等好处. 在git的版本控制系统,特别是,已由于其分散式架构,并在它可以使和转让方之间变化的速度看到广 ...

  4. git 修复中间版本_如何修复git中的错误并且不留痕迹

    git 修复中间版本 You finally found it: a bug in an old commit! And luckily, you already have a solution in ...

  5. git stage 暂存_什么是Git?下载和安装Git

    3. 使用git管理代码 3.1 什么是git? git ==git: 开源的分布式版本控制系统,也可以用于内容管理== git的作用 工作区:就是你在电脑里能看到的目录. 暂存区:英文叫stage, ...

  6. git fork clone 区别_我的Git笔记

    每次用到git,总会遇到一些问题,所以写这篇文章记录一下. fork 等fork完之后,你可以在自己的仓库中看到同名的项目,URL的形式:https://github.com/your_name/re ...

  7. git clone 多个_如何通过Git参与项目开发

    Git介绍 QA& 小白 Git 是什么? Git是一个开源的免费的分布式版本管理系统,最初是由Linux内核发明人Linus Torvalds用于管理Linux内核开发而开发的. 大神 小白 ...

  8. git git 查看远程库_如何从Git远程存储库中提取

    git git 查看远程库 Note: This the fourth video in the Git for beginners series. Watch the first video her ...

  9. 两个git库之间迁移_从一个git仓库迁移代码到另一个git仓库(亲测有效版)(转)...

    不保留log等提交的记录的迁移就不说了,soeasy!代码复制粘贴就可以 目标:把A仓库的代码迁移到B仓库并且保存所有的git log,B仓库已经存在了哦,哪怕是个空仓库. 再说这个之前先说点其他.在 ...

最新文章

  1. 追溯XLNet的前世今生:从Transformer到XLNet
  2. 人脸识别机器学习实战
  3. 2021年第十二届蓝桥杯 - 省赛 - C/C++大学B组 - I.双向排序
  4. Wang Xifeng's Little Plot (poj 5024 DFS)
  5. C#里巧用DateTime预设一些可选的日期范围(如本年度、本季度、本月等)
  6. 系统架构师学习笔记-开发管理
  7. js判断是否以xxx结尾
  8. 内核模块编程之_初窥门径【ZT】
  9. http请求/相应及如何在chrome中查看
  10. 企业如何搭建物联卡云平台
  11. 马蜂窝与滴滴联合发起:“旅游+交通”优化旅客出行方案
  12. c语言依次调用字符串中的元素,C语言经典题目(某校复试真题)
  13. IPQ4019/QCA9531/MT7628/MT7621系嵌入式无线双频AP核心模块选型探讨
  14. postgresql点云las_三维点云目标提取总结【转】
  15. Word中批量更新域的两个小方法;更新角标;更新引用
  16. css 图片放大1.2倍,什么是二倍图?怎样使用二倍图?
  17. 平面设计师okr_为什么说一名优秀的设计师要懂得OKR
  18. (github附源码)毕设微信小程序二手书交易后台PHP微擎
  19. 无聊写着玩:解二阶线性微分方程
  20. 复旦大学计算机应用复试线,2019年复旦大学考研复试分数线已出现

热门文章

  1. 博客园点击出现富强民主
  2. 少儿编程scratch(2022.04.06)
  3. hp desktop 288加装苹果网卡bcm94331csax macOS10.5.5
  4. Flutter性能优化实践 —— UI篇
  5. 浏览器上传文件窗口空白无内容或者点击按钮不弹出文件选择的问题
  6. CoolShell 博客备份QA问答
  7. 菜鸟已OC(秋招春招找工作经历分享)
  8. 用Python+OpenCV进行数据扩充
  9. Oracle快速批量导入数据
  10. 您所说的:您最喜欢的合作游戏