1.git am出现冲突

idh.code$ git am --directory=idh.code/packages/apps/Settings -s packages/apps/Settings/001-800497.diff
Applying: Bug #1635173[S3]删除addon机制相关的逻辑
warning: idh.code/packages/apps/Settings/Android.mk has type 100755, expected 100644
error: patch failed: idh.code/packages/apps/Settings/Android.mk:62
error: idh.code/packages/apps/Settings/Android.mk: patch does not apply
warning: idh.code/packages/apps/Settings/src/com/android/settings/DeviceInfoSettings.java has type 100755, expected 100644
Patch failed at 0001 Bug #1635173[S3]删除addon机制相关的逻辑
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

2.git apply --reject合入不冲突部分,保留冲突部分

出现跳过文件的问题,请检查路径是否正确!

idh.code$ git apply --reject packages/apps/Settings/001-800497.diff
Skipped patch 'Android.mk'.
Skipped patch 'res/values/config.xml'.
Skipped patch 'src/com/android/settings/DeviceInfoSettings.java'.
Skipped patch 'src/com/android/settings/OwnerInfoSettings.java'.
Skipped patch 'src/com/android/settings/SetLimitOwnerInfoLength.java'.
Skipped patch 'src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java'.

更正如下:

idh.code$ git apply --directory=idh.code/packages/apps/Settings --reject packages/apps/Settings/001-800497.diff
Checking patch idh.code/packages/apps/Settings/Android.mk...
warning: idh.code/packages/apps/Settings/Android.mk has type 100755, expected 100644
error: while searching for:
    jsr305 \
    settings-logtags \
    android-support-design \
    android-support-v7-appcompat

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

ifneq ($(INCREMENTAL_BUILDS),)

error: patch failed: idh.code/packages/apps/Settings/Android.mk:62
Checking patch idh.code/packages/apps/Settings/res/values/config.xml...
Checking patch idh.code/packages/apps/Settings/src/com/android/settings/DeviceInfoSettings.java...
warning: idh.code/packages/apps/Settings/src/com/android/settings/DeviceInfoSettings.java has type 100755, expected 100644
Hunk #1 succeeded at 189 (offset 20 lines).
Checking patch idh.code/packages/apps/Settings/src/com/android/settings/OwnerInfoSettings.java...
Checking patch idh.code/packages/apps/Settings/src/com/android/settings/SetLimitOwnerInfoLength.java...
Checking patch idh.code/packages/apps/Settings/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java...
Hunk #3 succeeded at 53 (offset 1 line).
Applying patch idh.code/packages/apps/Settings/Android.mk with 1 reject...
Hunk #1 applied cleanly.
Rejected hunk #2.
Applied patch idh.code/packages/apps/Settings/res/values/config.xml cleanly.
Applied patch idh.code/packages/apps/Settings/src/com/android/settings/DeviceInfoSettings.java cleanly.
Applied patch idh.code/packages/apps/Settings/src/com/android/settings/OwnerInfoSettings.java cleanly.
Applied patch idh.code/packages/apps/Settings/src/com/android/settings/SetLimitOwnerInfoLength.java cleanly.
Applied patch idh.code/packages/apps/Settings/src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java cleanly.

3.git status 查看状态

idh.code/packages/apps/Settings$ git status .
On branch master
Your branch is up to date with 'origin/master'.

You are in the middle of an am session.
  (fix conflicts and then run "git am --continue")
  (use "git am --skip" to skip this patch)
  (use "git am --abort" to restore the original branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   Android.mk
	modified:   res/values/config.xml
	modified:   src/com/android/settings/DeviceInfoSettings.java
	modified:   src/com/android/settings/OwnerInfoSettings.java
	modified:   src/com/android/settings/SetLimitOwnerInfoLength.java
	modified:   src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java

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

	Android.mk.rej

no changes added to commit (use "git add" and/or "git commit -a")

4.手动解决冲突,并删除*.rej文件,然后git add

idh.code/packages/apps/Settings$ git status .
On branch master
Your branch is up to date with 'origin/master'.

You are in the middle of an am session.
  (fix conflicts and then run "git am --continue")
  (use "git am --skip" to skip this patch)
  (use "git am --abort" to restore the original branch)

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	modified:   Android.mk
	modified:   res/values/config.xml
	modified:   src/com/android/settings/DeviceInfoSettings.java
	modified:   src/com/android/settings/OwnerInfoSettings.java
	modified:   src/com/android/settings/SetLimitOwnerInfoLength.java
	modified:   src/com/android/settings/deviceinfo/BasebandVersionPreferenceController.java

5.git am --continue 继续被中断操作

idh.code$ git am --continue
Applying: Bug #1635173[S3]删除addon机制相关的逻辑

6.git log确认合入状态

idh.code$ git log 
commit 96f1fb2fa9f7ca6fe5f36838990c7bc13f0873ef (HEAD -> master)
Author: xxx <xxx@xxx.com>
Date:   Fri Jun 18 14:15:24 2021 +0800

    Bug #1635173[S3]删除addon机制相关的逻辑
Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐