I have a local branch named as source_report_overview_Approach3 and there is a remote counterpart of it as origin/source_report_overview_Approach3 on github.
At a point , both point at same commit, as shown in the below image.
Now I make another commit(
git commit) to my local branch with message "test commit". This moves my local branch a commit forward while keeping the remote at same place as shown below:
Now I push this commit to remote (
git push origin source_report_details_Approach3). This as I understand git should moveremotes/origin/source_report_details_Approach3to the later commit i.e.test commitand again my local and remote branch should be in sync and should point to sametest commit, But somehow it does something like shown below:
Now if i do
git status, it gives me the following message:
I believe this should not happen. Shouldn't the remotes/origin/source_report_details_Approach3be updated to point tosource_report_details_Approach3automatically.I made another commit(
git commit) by making changes at the same place in the same file as I had made in committest commitwith messagetest commit 2. It makes the history as follows:
Now i try to push this commit(
test commit 2), then i get the following error:

How may I solve this problem. By whatever I know about git, this is weird to happen.
If I try to pull the branch using
git pull origin source_report_details_Approach3, then it gives merge conflicts. This is becausetest commit and test commit 2both make changes at same place in same file. Git try to mergetest commitfrom remote to my local branch. Since my local file hastest commit 2, it gives a conflict.Also I am the only person working on the branch. Still because of the problem, I have to solve merge conflicts almost every time I have to push anything.
