Conflict with GIT / Github Version Control for same branch and only one user committing

1

I am harduser and experienced programmer, however a problem has been occurring: for a private repository in Github, with only one user committing, eventually sending code I receive notice that it was denied , and that I need to give pull before. When this is done, git alerts extremely stupid errors, and when "resolving", the github interface displays the following:

Merge branch 'master' of github.com:fititnt/repositorio
Conflicts:
    pasta/pasta2/arquivo.js

master
fititnt authored 11 minutes ago
Showing 0 changed files with 0 additions and 0 deletions.

Relevant points

  • Only one user, just one computer (Ubuntu 12.04), using command line and git gui and gitk
  • Apparently, there is no change of file permissions when this error occurs
  • I never use --force , git rebase and git commit --amend .
  • git version 1.7.9.5
  • The error does not happen always . It usually occurs when I'm away from the computer for several hours.

Temporary contouring solution

Contour solution that I use when doing this is to save all changes out of git, use the command git reset --hard HEAD~1 which effectively destroys any reference to the commit that was done locally, pull pull, reapply the changes and then commit successfully and without error. But this is annoying to do at least once every day or two.

I'm suspicious that this may be a Github bug or git bug.

    
asked by anonymous 05.02.2014 / 16:33

1 answer

6

Instead of giving git pull , make a git fetch , and then git log origin/branch and git log branch to compare the location with the remote, and find out exactly what it has on the remote that it does not have in place, to find out what's going on.

I assume you do not git rebase or git commit --amend ? Using these commands after a push will make the repositories diverge, causing problems of this type (solution: never rebase or amend after push, or, if you do, use --force on push).

    
05.02.2014 / 17:07