好的,我搞砸了并提交,并将所做的更改推送到了一个分支,该分支应该用作干净的主分支release/2.0
。因此,我提交了所有内容并将其合并到该master分支。
相反,我应该从release/2.0
创建一个分支,然后将所有工作都放在其中,然后提交并推送并合并到release2.0
。
我该如何完成?这是我的git reflog --date=iso
:
22a3aed (HEAD -> member_benefits_config, origin/release/2.0, release/2.0) HEAD@{2019-07-08 13:50:12 -0500}: checkout: moving from release/2.0 to member_benefits_config
22a3aed (HEAD -> member_benefits_config, origin/release/2.0, release/2.0) HEAD@{2019-07-08 13:36:51 -0500}: pull origin release/2.0: Merge made by the 'recursive' strategy.
2da8de0 HEAD@{2019-07-08 13:35:28 -0500}: commit: Added MemberBenefits configuration
4652cf5 (origin/master, origin/HEAD, master) HEAD@{2019-07-08 13:32:22 -0500}: checkout: moving from master to release/2.0
4652cf5 (origin/master, origin/HEAD, master) HEAD@{2019-07-08 13:32:10 -0500}: reset: moving to HEAD~1
8bd42a0 HEAD@{2019-07-08 13:01:19 -0500}: commit: Added MemberBenefits step component
4652cf5 (origin/master, origin/HEAD, master) HEAD@{2019-07-01 11:24:26 -0500}: clone: from https://CortesD@bitbucket.nfib.org/scm/enga/engage-application.framework.git
我会在“ master”分支上进行git reset --hard 22a3aed
吗?或4652cf5
提交,因为我第一次搞砸,不得不重新设置。
答案 0 :(得分:0)
假设在release/2.0
上进行以下提交:
17f4e3b87 commit 5
b5fdf57ab commit 4
ad53f1aa0 commit 3
3b6864d4d commit 2
88b87878d commit 1
假定“ commit 2”是您要返回的提交。您可以执行以下操作:
# create a branch and push changes to it
(release/2.0) git checkout -b my_branch
(my_branch) git push origin my_branch
在引入更改之前,现在将release/2.0
重置为一次提交:
git checkout release/2.0
git reset --hard 3b6864d4d
git push origin releases/2.0 -f