Git 的patch 功能

git patch

1. git format-patch -1

打一个当前提交的补丁,也就是最后一次的提交改动, 相当于svn diff

2.git fromat-patch -1 6525c43add803bfee37cf5c1cb573ed8aecf529e   

 打一个指定具体某一次的补丁

3.git format-patch -2 6525c43add803bfee37cf5c1cb573ed8aecf529e  

 打基于指定具体某个版本的接连两次的补丁

4.git format-patch –s HEAD~3..HEAD  //将最近3个提交转换为3个补丁文件

 -s  参数会在导出的补丁文件里面添加当前用户的签名

5. git  am mail-file  //将mbox格式的从mail 发过来的patch应用回来.

6.git apply   patch-name  //应用一般的patch,但是不能执行提交操作

Changes to be committed:

#   (use "git reset HEAD <file>..." to unstage) //reset 加--soft 会保持文件的stage状态,(to be committed,这往往是被撤消的提交中的文件,stage中的文件的修改是diff不出来的), 如果不加(默认:mixed)就会把所有mark to be committed的文件全unstage掉,这时可以diff出来该文件的改动了

#

#    modified:   packages/apps/Contacts/src/com/android/contacts/ContactsUtils.java  //不会被diff出来,

#

 

# Changed but not updated:                        //会被diff出来

#   (use "git add <file>..." to update what will be committed)

#   (use "git checkout -- <file>..." to discard changes in working directory)

#

#    modified:   frameworks/base/core/java/com/android/internal/app/RingtonePickerActivity.java

#    modified:   frameworks/base/media/java/android/media/RingtoneManager.java

#

 

# Untracked files:                                       //不会参与版本管理,除非用git add进来

#   (use "git add <file>..." to include in what will be committed)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值