I am developing a little Rails application with a friend of mine. We are using git and github.com to share the code.
My 开发者_如何转开发friend made a change to one of our files, committed locally and pushed to github.com. All worked fine. I pulled from github.com, without error. However, one of the changes he made is not reflected in my copy of the file!
Some specifics.
The file is a view file and it contained the lines
<td class="todo content">
<%= todo.done %>
</td>
My fiend deleted those 3 lines.
I did git pull origin master
. It merged my repository and said I am now up to date.
git status
shows:
# On branch master
nothing to commit (working directory clean)
However, my copy of the file still contains those 3 lines.
git log --pretty=oneline
clearly shows the commit in question:
e1bab819ef164463ee484b34aa3f5dc3cabd4ea1 Updated delete links to icons, removed Done colum
git show e1bab819ef164463ee484b34aa3f5dc3cabd4ea1
shows the lines being deleted:
commit e1bab819ef164463ee484b34aa3f5dc3cabd4ea1
Author: ...elided
Date: Mon Feb 21 05:39:08 2011 +1100
Updated delete links to icons, removed Done column, added titles to edit and delete li
diff --git a/.rspec b/.rspec
new file mode 100644
index 0000000..53607ea
--- /dev/null
+++ b/.rspec
@@ -0,0 +1 @@
+--colour
diff --git a/app/views/todos/_todo.html.erb b/app/views/todos/_todo.html.erb
index 0461353..bd4102b 100644
--- a/app/views/todos/_todo.html.erb
+++ b/app/views/todos/_todo.html.erb
@@ -18,19 +18,16 @@
<td class="todo content" nowrap>
<%= user_name(todo, @show_assignee) %>
</td>
- <td class="todo content">
- <%= todo.done %>
- </td>
I am convinced this problem has to do with my lack of understanding, rather than being a bug in git. But it makes me very nervous, wondering whether we are both actually working on different copies of the code!
How come my local copy is not the same as the the version on the main server?
You just added again the three lines in the following commit: https://github.com/thedanielmay/testapp/commit/85ea23c00a08456613e14804a618da3cbab9f949#L1R21
精彩评论