2017-08-04 44 views
2

步骤我接过后:还原一个空的合并提交已被推迟

  1. 合并的主分支到我的特性分支。
  2. 开始解决提交,意外解决使用他们在其中的冲突之一,并希望重做它。
  3. 重置所有更改。
  4. 在这一点上,我似乎做任何事情不能因为我是在合并状态时,我不小心犯下这些变化,并推到GitHub上(我用SourceTree,离开了选项打勾!)

现在,每当我尝试从主合并它假设我已经有最新的变化,并没有添加到我的功能分支。

我试图运行git revert -m 1 <commit hash of the empty commit>,但我是越来越:

On branch feature/profile_page 
Your branch is up-to-date with 'origin/feature/profile_page'. 
nothing to commit, working tree clean 

然后我试图恢复其没有工作之前,它的变化,但目前当地是一个提交GitHub上的特性分支后面。

任何想法?

这里是我的日志:

* ff46aa6 (HEAD -> feature/profile_page, origin/feature/profile_page) Revert  "Added link to user profile page in MainMenu" 
* 64e96b3 . 
|\ 
| * 9c023f5 (origin/master, origin/HEAD, master) Made the delete button invoke a pop-up which can delete the responders. 
| * 87a028c Added a placeholder page that can be used to link to, or navigate from when you need a placeholder page. 
| * 6ae954d Added the ResponderGroupPage and new delete icon. 
| * 752fb83 Updated the layout to closer match the mock-up 
| * 55e8c29 Added missing schedule icon 
| * 6255338 Tweaks to make the page work/look correct on iOS 
| * 178beb1 Update to the IncidentHistoryPage so that it displays a history of an event as a list under your selected item when you select one. 
| * 5bfbbf1 Added titles to pages and button to link to IncidentHistoryPage. 
| * 4570346 Added basic IncidentHistoryPage using mock data 
* | 663a378 Added link to user profile page in MainMenu 
* | 123da81 Added EditProfilePasswordPage and CloseAccountPage 
* | 40a00ea Added change phone number page 
* | b80f9af Added Change email page 
* | 8a3710a Added MySubscriptions Page 
* | 3c8ddee Added MyAccountPage 
* | dd4fa9e ImageWithPopupMenu handles events 
* | cbfae5f Added ImageWithPopupMenu 
* | 304dd5c . 
* | b730e7f EditProfilePage first pass 
* | 0ac9603 Added UserProfile view model 
* | af7f6ed . 
* | 5f4e0c0 Profile Page first pass 
| | * bbbbc4d (origin/feature/api_hooks) Setting up a wearer after activating a device will now associate the wearer with the device. Added WearerDataStore which will retrieve and manage the wearer list shown on the home screen. 
| | * 45b3639 App will now check if a user is currently logged in when it launches.  - If there is currently an active session, which is not authenticated with the API key, then the app will navigate to the home screen instead of landing. 
| | * 88250f5 Sign in page now using Bindings with view model for the entry text. Sign in page now using localisation. Added api calls to sign up process. Added validation to the sign up process for checking email address and phone numbers. 
| |/ 
| * 2590342 Merge branch 'master' of https://github.com/FirstAppLtd /Watchie_Xamarin 
| |\ 
| | * 4e13537 Added the EditSafezonePage and placeholder pop-ups for CALL/RAISE SOS on the Homescreen and Wearer Profile screens. 
| | * ee1a2dc Merge branch 'master' into hockeyapp_integration 
| | |\ 
| | | * 7f1d961 New icon paths 
| | * | 3d05a1f Merge branch 'master' into hockeyapp_integration 
| | |\ \ 
| | | |/ 
| | | * 66d6303 Reworked the Homescreen so that it works on iOS as the list view didn’t work correctly. I moved the Icons on iOS into the root resources so that they can be indexed in the same way as on Android to avoid any needing to do #ifIOS look here. 
| | | |\ 
| | | | * d7e2d63 (origin/UpdatingIcons) Fix for the Homescreen so that it displays correctly on iOS. Moved where the iOS icons are stored so that they can be referenced exactly like the Android assets. 
| | | | * 5d6846a New branch updating the icons 
| | * | | a8d3ddc Set Android HockeyAppId 
| | * | | df479a2 Set iOS HockeyAppId 
| | * | | d0c820d Integrated HockeyAppId from info.plist. Disabled AuthenticateInstallation call for current config. 
| | * | | d0702fe Added iOS HockeyApp to the Info.plist file 
| | * | | 05f627a Refactored the HockeySDK App ID to the AssemblyInfo file for Android 
| | * | | f99cf8e Added HockeySDK update to Android 
| | * | | d0c94d0 Added ability to enable HockeySDK User metrics in Android 
| | * | | 2b14729 Disabled HockeySDK for iOS 
| | * | | 32fa935 Integrated HockeySDK for Android to detect crashes 
| | * | | 58017a5 Added HockeySDK NuGet package to Android solution 
+0

你可以添加你的git日志吗?我也想知道为什么你会将主人合并到你的特色分支中,似乎有点奇怪? – sp1nakr

+0

将主人合并到该功能,以确保在承诺掌握之前一切正常,将附上日志 – RobVoisey

+0

请使用''git log --decorate --all --oneline --graph''或类似 – sp1nakr

回答

2

根据你的日志中,我认为最干净的解决方案是:

git checkout 663a3784ab82f019996a5091f3dfb2401c0403b5 -b feature_clean 

这将签出您标记为一个新的分支“feature_clean”,“有效”(您的编辑前)在合并之前提交。然后你可以执行合并(git merge master),并确保它是干净的。最终,您可以通过feature_clean替换功能,例如,删除前和重命名后:

git branch -d feature # delete old branch 
git branch -m feature_clean feature # rename clean branch 
git push -f # force push feature to rewrite history on remote 

为什么我不建议git reset 663a37... --hard接着力推动的原因是,你保持这样的“破”分支,可以经常根据需要进行git checkout 663...它来解决冲突。

我希望这会有所帮助。

+0

谢谢!这似乎是最干净的解决方案;作为我的功能分支结束后,我承诺掌握我不需要保持它,所以它是最有意义的。 – RobVoisey

+0

很高兴能帮到你! – SVSchmidt

1

您恢复合并,这将创造一个新的提交撤销该承诺之前提交。我认为你想要做的是git reset它重置分支引用提交。

如果你想恢复到你合并什么可以做前:

git checkout feature/profile_page git reset --hard 663a378将本地设置的特性分支的提交合并提交之前。在遥远的地方,你将不得不做一个git push -f,这将重写你的遥控器的历史。如果你是唯一一个在分支上工作的人,并且给予你正确的权限,那就没问题。

或者您可以在663a378 git checkout -b 663a378上创建一个新的功能分支,您可以使用该分支来完成您想要的合并。

1

这是重播你的承诺的一种方式:

  1. 从提交663a378重启,用“进展中的工作”分支:

    git branch wip 663a378 
    git checkout wip 
    
  2. 重新运行“合并掌握到这分支“:

    git merge master 
    
  3. 解决冲突,
    并提交,可能]编辑承诺把你所期望的分支名称的消息(如:中"merge master into feature/profile_page"代替"merge master into wip"

  4. ,如果你不满意这个新的合并:将以前的分支这些新提交:

    # push current commit to the remote "feature/profile_page" branch : 
    git push -f origin wip:profile_page 
    
    # set your local "profile_page" branch to this new commit : 
    git branch -f profile_page wip 
    
    # switch to other branch and delete wip : 
    git checkout profile_page 
    git branch -d wip 
    
相关问题