“git format-patch”相当于单个文件? [英] "git format-patch" equivalent for a single file?

查看:215
本文介绍了“git format-patch”相当于单个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的一个同事把我的项目分开了,并且我们希望将他的更改合并到我的回购中,保留其历史记录(主要是提交日志)。问题在于他的提交很笨拙,所以提交包含其他文件的差异,与项目无关(或者需要将其拖入原始回购库中)。



我希望能够做一个git format-patch来提取历史记录,但只能用于单个文件(或者两个,.cpp和.hpp文件)。

是否有可能?



Thanx !

解决方案

嗯......所以其实很简单:

  git format-patch commit_id file(s)

其中commit_id是第一次创建修补程序的父母,后面跟着一个或多个文件...

A collegue of mine forked my project and we want to incorporate his changed on a single file into my repo, keeping its history (mainly the commit logs).

The problem is that he clumsy in his commits so the commits contains diff from other files as well, unrelated to the project (or what need to be pulled into the original repo).

I would like to be able to do a "git format-patch" to extract the history, but only for a single file (or maybe two, the .cpp and .hpp files). I could not find an option to "format-patch" for this.

Is it possible?

Thanx!

解决方案

Hum... So actually it's as simple as:

git format-patch commit_id file(s)

where commit_id is the parent of the first commit to create a patch followed by the file or files wanted...

这篇关于“git format-patch”相当于单个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆