Git保留最新提交,但之前删除一个

时间:2018-09-10 10:35:43

标签: git gerrit git-commit

我正在尝试将最新的Git-Commit推向Gerrit。 但是不知何故,我收到一条错误消息,说我无法推送,因为两个提交具有相同的Change-ID。

在下图中,您可以看到当前情况。

  1. 第三个提交(从顶部开始)已经推送到gerrit。
  2. 第三次提交和第二次提交具有相同的Change-ID。
  3. 我想将第一次提交推送给gerrit。

enter image description here

所以我要解决此问题的想法是删除第二个提交。 这可能吗?

1 个答案:

答案 0 :(得分:3)

假设从上到下的三个提交的提交哈希分别是A,B和C。

确保[18-09-10 11:16:00.566] Build started. [18-09-10 11:16:14.242] (CLI) Executing before-shouldPrepare hook from /Volumes/Seagate2TB/projects/nativescript/MyApp/hooks/before-shouldPrepare/nativescript-dev-webpack.js [18-09-10 11:16:14.245] (CLI) Executing before-prepare hook from /Volumes/Seagate2TB/projects/nativescript/MyApp/hooks/before-prepare/nativescript-dev-sass.js [18-09-10 11:16:14.248] (CLI) Found peer node-sass [18-09-10 11:16:15.000] (CLI) Executing before-prepare hook from /Volumes/Seagate2TB/projects/nativescript/MyApp/hooks/before-prepare/nativescript-dev-typescript.js [18-09-10 11:16:15.004] (CLI) Found peer TypeScript 2.7.2 [18-09-10 11:16:23.066] (CLI) Preparing project... [18-09-10 11:16:23.070] (CLI) Executing before-prepareJSApp hook from /Volumes/Seagate2TB/projects/nativescript/MyApp/hooks/before-prepareJSApp/nativescript-dev-webpack.js [18-09-10 11:16:23.298] (CLI) Project successfully prepared (iOS) [18-09-10 11:16:23.301] (CLI) Executing after-prepare hook from /Volumes/Seagate2TB/projects/nativescript/MyApp/hooks/after-prepare/nativescript-dev-sass.js [18-09-10 11:16:23.932] (CLI) All SASS source files removed from app package [18-09-10 11:16:23.935] (CLI) Executing after-prepare hook from /Volumes/Seagate2TB/projects/nativescript/MyApp/hooks/after-prepare/nativescript-dev-webpack.js [18-09-10 11:16:23.935] (CLI) Building project... [18-09-10 11:16:24.390] (CLI) Xcode build... [18-09-10 11:16:25.056] (CLI) 2018-09-10 11:16:25.055 xcodebuild[3529:41494] [MT] PluginLoading: Required plug-in compatibility UUID B395D63E-9166-4CD6-9287-6889D507AD6A for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs [18-09-10 11:17:11.455] (CLI) === BUILD TARGET MyApp OF PROJECT MyApp WITH CONFIGURATION Debug === [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/NYRHVEZZLW1G/UIKit-2LM3EQU7VVY4O.pcmwhile processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2B9CA3IY919IU/UIKit-2LM3EQU7VVY4O.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) note: Linking a static library that was built with -gmodules, but the module cache was not found. Redistributable static libraries should never be built with module debugging enabled. The debug experience will be degraded due to incomplete debug information. [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2B9CA3IY919IU/Darwin-MI6WZSG1PNOM.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2B9CA3IY919IU/Foundation-A3SOD99KJ0S9.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2B9CA3IY919IU/Dispatch-12O7S7HHQXK9N.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/2B9CA3IY919IU/ObjectiveC-1KD62J152BYGO.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) : No such file or directory [18-09-10 11:17:11.460] (CLI) note: Linking a static library that was built with -gmodules, but the module cache was not found. Redistributable static libraries should never be built with module debugging enabled. The debug experience will be degraded due to incomplete debug information. [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/NYRHVEZZLW1G/Darwin-MI6WZSG1PNOM.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/NYRHVEZZLW1G/Foundation-A3SOD99KJ0S9.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/NYRHVEZZLW1G/Dispatch-12O7S7HHQXK9N.pcm: No such file or directory [18-09-10 11:17:11.460] (CLI) while processing /Volumes/Seagate2TB/projects/nativescript/MyApp/platforms/ios/internal/TKLiveSync/TKLiveSync(TKLiveSync.o): [18-09-10 11:17:11.460] (CLI) warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/NYRHVEZZLW1G/ObjectiveC-1KD62J152BYGO.pcm: No such file or directory [18-09-10 11:17:50.083] (CLI) Xcode build... [18-09-10 11:17:50.900] (CLI) 2018-09-10 11:17:50.899 xcodebuild[3978:45152] [MT] PluginLoading: Required plug-in compatibility UUID B395D63E-9166-4CD6-9287-6889D507AD6A for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin' not present in DVTPlugInCompatibilityUUIDs [18-09-10 11:17:51.320] (CLI) 2018-09-10 11:17:51.318 xcodebuild[3978:45152] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/w0/l3ftdv311vvbzfmklzs979x00000gn/T/MyApp_2018-09-10_11-17-51.315.xcdistributionlogs'. [18-09-10 11:18:00.134] (CLI) 2018-09-10 11:18:00.133 xcodebuild[3978:45152] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ffe13d057d0>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=( [18-09-10 11:18:00.134] (CLI) "Error Domain=IDEProvisioningErrorDomain Code=9 \"\"MyApp.app\" requires a provisioning profile.\" UserInfo={NSLocalizedDescription=\"MyApp.app\" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}" [18-09-10 11:18:00.134] (CLI) )} [18-09-10 11:18:00.138] (CLI) error: exportArchive: "MyApp.app" requires a provisioning profile. [18-09-10 11:18:00.138] (CLI) Error Domain=IDEProvisioningErrorDomain Code=9 ""MyApp.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="MyApp.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.} [18-09-10 11:18:00.138] (CLI) ** EXPORT FAILED ** 干净。如果没有,请先运行git status

如果您真的不再想要B,

git stash

如果您仍然想要B,

git reset C --hard
git cherry-pick A

然后再次按下。