git pull --rebase 丢失了我的提交
git pull --rebase lost my commit
我对一个文件做了一个非常小的改动。
单行更改了以下内容:
@@ -1,3 +1,3 @@
{
- "cordova-cli": "5.2.0"
+ "cordova-cli": "5.4.1"
}
我提交了更改并执行了 pull rebase
git add taco.json
git commit -m "updated the cordova cli version"
git pull --rebase
现在,当我执行 git 日志时,我看不到我的更改。其他人在另一个提交中做了完全相同的更改。 git 是否认识到这一点并取消了我的提交?
我仍然在 git reflog
中看到它。
我本以为会发生合并冲突,而不是让我的提交完全消失。
这是 git 日志和 git reflog 的输出:
git log --oneline
d8cb5c3 removed upload from gulp task
0ed5d5b updated analytics codeanalytics
901f724 minor style changes to search buttons
git reflog
d8cb5c3 HEAD@{0}: rebase finished: returning to refs/heads/dev
d8cb5c3 HEAD@{1}: pull --rebase: checkout d8cb5c341c7b08d6a9b43d89198171596d0c4234
f931b4e HEAD@{2}: commit: updated cordova cli version
如果您的提交与另一个提交完全相同并且没有进行任何更改(当然也没有冲突),那么可以。 Git 不应用提交,因为它什么都不做。
尝试 'cherry-pick' 此提交,您将看到消息:
nothing to commit, working directory clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
在 rebase 期间,git 不显示任何消息并简单地删除提交。
冲突是指同一行有不同的更改,但更改是相同的 - 没有冲突。
要将您的提交记录在日志中,您必须使用更改来编辑其他提交,但由于它已经在上游 - 这不是一个好主意,因为历史记录重写涉及强制推送并可能导致丢失工作
我对一个文件做了一个非常小的改动。
单行更改了以下内容:
@@ -1,3 +1,3 @@
{
- "cordova-cli": "5.2.0"
+ "cordova-cli": "5.4.1"
}
我提交了更改并执行了 pull rebase
git add taco.json
git commit -m "updated the cordova cli version"
git pull --rebase
现在,当我执行 git 日志时,我看不到我的更改。其他人在另一个提交中做了完全相同的更改。 git 是否认识到这一点并取消了我的提交?
我仍然在 git reflog
中看到它。
我本以为会发生合并冲突,而不是让我的提交完全消失。
这是 git 日志和 git reflog 的输出:
git log --oneline
d8cb5c3 removed upload from gulp task
0ed5d5b updated analytics codeanalytics
901f724 minor style changes to search buttons
git reflog
d8cb5c3 HEAD@{0}: rebase finished: returning to refs/heads/dev
d8cb5c3 HEAD@{1}: pull --rebase: checkout d8cb5c341c7b08d6a9b43d89198171596d0c4234
f931b4e HEAD@{2}: commit: updated cordova cli version
如果您的提交与另一个提交完全相同并且没有进行任何更改(当然也没有冲突),那么可以。 Git 不应用提交,因为它什么都不做。
尝试 'cherry-pick' 此提交,您将看到消息:
nothing to commit, working directory clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
在 rebase 期间,git 不显示任何消息并简单地删除提交。
冲突是指同一行有不同的更改,但更改是相同的 - 没有冲突。
要将您的提交记录在日志中,您必须使用更改来编辑其他提交,但由于它已经在上游 - 这不是一个好主意,因为历史记录重写涉及强制推送并可能导致丢失工作