I have a strange problem where a git pull is not completely updating a certain file.
I am working on a company project which has just one remote. My local repo is 3 commits ahead of the remote and in the meantime some other commits were pushed by another developer. We are both working off master.
So my scenario is, I stashed my local changes, pulled down the latest changes and noticed a conflict. No problem.
I resolved that conflict but then discovered that the resolution results in broken code. I checked the source code on the remote through Bitbucket and noticed that one of the methods in my code has not been updated at all. Please see below as an example.
Local repo (before pull)
public Object method1() throws Exception {
return method2();
}
public Object method2() throws Exception {
return generateSomeObject();
}
Remote repo (first method is renamed and different exception thrown)
public Object newMethod1() throws SQLException {
return method2();
}
public Object method2() throws SQLException {
Object object = null;
try {
object = generateSomeObject();
catch (SomeException e) {}
return object;
}
This results in a conflict like so After pull
<<<<<<< HEAD
public Object method1() throws Exception {
======
public Object newMethod1() throws SQLException {
>>>>>>> 453451432435
return method2();
}
public Object method2() throws Exception {
return generateSomeObject();
}
The conflict makes senses so that's fine. However, I don't understand why method2 hasn't been updated correctly. I would have expected it to show a conflict as well. As such all changes to this method have not been pulled down from the remote.
Can anyone shed any light on fixing this within git rather than copying across the omission manually?