GIT/Github Versioning Conflict for the same branch and only one commiting user

Asked

Viewed 4,691 times

1

I am harduser and experienced programmer, but a problem has occurred: to a private repository on Github, with only one user committing, eventually when sending code I receive notice that it has been denied, and that I need to pull before. When this is done, git warns extremely stupid errors, and when "resolve", 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, from only 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
  • Never use --force, git rebase and git commit --amend.
  • git version 1.7.9.5
  • The mistake doesn’t happen at all times. It usually happens when I’m several hours off the computer.

Temporary contour solution

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

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

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 what exactly is on the remote that has no location, to find out what is happening.

I assume you don’t git rebase or git commit --amend? Using these commands after a push will cause the repositories to diverge, causing problems of this type (solution: never rebase or Amend after push, or if you do, use --force in push).

  • I changed the question to make it explicit that git rebase or git commit --amend are used. I will have to wait for the error to repeat to test the git fetch -> git log origin/branch -> git log branch.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.