我工作的公司中的一个团队遇到了 git 问题。
- 1 - 说 dev1 向 file.txt 提交和推送一行广告。
- 2 - 同时 dev2 在同一个文件上工作,但不涉及相同的行。
- 3 - Dev2 提交、拉取和推送。
- 4 - 当 dev1 在步骤 1 中拉线时,不知何故丢失了。它被删除了。(有时 dev1 会看到一条错误消息,指出无法打开编辑器来编辑合并提交消息,如下面的更多详细信息所述)
我不认为这是一个 git bug 或什么的,因为我从来没有遇到过这种问题。我真的认为问题出在工作流程中。我认为这可能是在 dev2 拉出后 sublime 编辑器没有刷新 file.txt ,但这不是原因。
有人有类似的问题吗?
编辑:
我的 git 版本是 1.7.9.5 dev1 是 1.7.12.4 dev2 是 1.7.10.4
Dev1 报告了一些合并代码,但由于无法打开编辑器而失败。我从未听说过在拉取后编辑提交消息,这导致我看到这篇文章,其中解释了 versopm 1.7.10+ 打开编辑器以在拉取后提供合并消息。这会导致问题吗?
编辑 2
此外,dev1 git config 是
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
url = url
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
编辑 3
提交哈希是与导致问题的 dev1 拉取相关的所有哈希。第一列是行数
git ld | nl | grep -e 9b95d03 -e 53d397d -e d6b221c -e fd73722 -e d4ae4c1 -e 2e4fe3b -e 63ac034 -e 7b20cd0 -e 81b6bf4 -e 087583c
4 9b95d03 | 4 hours ago | Merge branch 'master' of git:repo | [dev1] ######## pulls and bazinga! Line gone.
5 53d397d | 4 hours ago | fake msg | [dev1]
8 d6b221c | 5 hours ago | Merge branch 'master' of git:repo | [dev2]
9 fd73722 | 5 hours ago | fake msg | [dev1]
10 d4ae4c1 | 5 hours ago | fake msg | [dev2] ######### line removed. [dev2] sweares he wasn't working near that feature
16 2e4fe3b | 18 hours ago | Merge branch 'master' of git:repo | [dev2]
17 63ac034 | 18 hours ago | Merge branch 'master' of git:repo | [dev2]
18 7b20cd0 | 18 hours ago | add shadow | [dev1]
19 81b6bf4 | 18 hours ago | ajustes | [dev2]
20 087583c | 19 hours ago | add widget blog | [dev1] ######## line added
编辑 4
# git log --graph --ancestry-path 087583c..9b95d03 -- assets/styles/site.css
* commit 9b95d03ccbfbcc21269c703f07e30c4b03517d00
|\ Merge: fd73722 d6b221c
| | Author: Dev1
| | Date: Wed Jun 26 11:19:46 2013 -0300
| |
| | Merge branch 'master' of git:repo
| |
| * commit d6b221c96c227f7577f8322d77fe56537f1a86df
| |\ Merge: d4ae4c1 fd73722
| |/ Author: Dev2
|/| Date: Wed Jun 26 09:53:07 2013 -0300
| |
| | Merge branch 'master' of git:repo
| |
| * commit d4ae4c1c21ae1b904cf6609331459c0eca7bb774
| | Author: Dev2
| | Date: Wed Jun 26 09:51:04 2013 -0300
| |
| | acabamentos resp
| |
* | commit fd73722b1c5a9045e5de2e5fb5fc50334f66b75a
| | Author: Dev1
| | Date: Wed Jun 26 09:51:25 2013 -0300
| |
| | fix menu sabotado
| |
* | commit 787b77d2e513c9358be0d077ad37860d244c1373
| | Author: Dev1
| | Date: Wed Jun 26 09:39:32 2013 -0300
| |
| | devolucao de código sabotado
| |
* | commit cfa4b113d668a12ee784a13dc488887c7a7a59c5
| | Author: Dev1
| | Date: Tue Jun 25 21:01:45 2013 -0300
| |
| | fix menus
| |
* | commit 8037155ae0ae0089bc589a4fc7071fba825546c5
| | Author: Dev1
| | Date: Tue Jun 25 20:45:41 2013 -0300
| |
| | acabamentos fix
| |
* | commit 64459bb5dc0284ea103c739464798f0da0e704a9
|\ \ Merge: af2f520 2e4fe3b
| |/ Author: Dev1
| | Date: Tue Jun 25 20:38:24 2013 -0300
| |
| | Merge branch 'master' of git:repo
| |
| * commit 2e4fe3b5a8f7efe2d6f3b15403e964134c888c7b
| |\ Merge: 63ac034 7b20cd0
| | | Author: Dev2
| | | Date: Tue Jun 25 20:31:51 2013 -0300
| | |
| | | Merge branch 'master' of git:repo
| | |
| * | commit 63ac0340faabc9defe4a45f65aeccaf3e5aba8b9
| / Merge: 81b6bf4 087583c
| | Author: Dev2
| | Date: Tue Jun 25 20:30:57 2013 -0300
| |
| | Merge branch 'master' of git:repo
| |
* | commit af2f5200269e2f3fa22ec911a14149357a8e3810
|/ Author: Dev1
| Date: Tue Jun 25 20:38:18 2013 -0300
|
| fix
|
* commit 7b20cd0b44fddc6b594546f6d75049d1c4522119
Author: Dev1
Date: Tue Jun 25 20:30:54 2013 -0300
add shadow