Strange git behavior

The other day, I updated tiny_mce in a git versioned project. At that time, I created a git branch for change and combined it to manage and delete the branch. Everything worked fine.

In addition, I changed the remote repo to another server and changed my .git / config. But I found out that I made a mistake, as shown below.

[remote "new_repo"] url = ssh:// username@git.mydomain.com /~/path/to/myproject.git fetch = +refs/heads/*:refs/remotes/new_repo/* [branch "master"] remote = old_repo <= WRONG merge = refs/heads/master 

It should be remote = new_repo . I adjusted it later and it seemed to work fine.

But after that, if I do "git status", the old tiny_mce files override the new one and they are in the modified list, but not committed. So I have to "git reset --hard HEAD". This happens in another copy of my project (updated via git). But I can not reproduce it. This seems to happen by accident (or I still can't find the template.)

What is happening and how can I fix it?

Here is my git -a branch:

 choir * master remotes/old_repo/master remotes/new_repo/master 

Updates and corrections:

It turned out that tiny_mce is a gem, that my rails application uses copies of the old tiny_mce and overwrites the new one every time I run rake some_task. I updated the tiny_mce pearl.

+6
source share
1 answer
  • remotes/old_repo/master - the result of your manual renaming. In the future, prefer git remote rename or even just git remote set-url to update your remotes, and it will clear all these things for you.

    Cleaning up after the fact is pain; git remote prune should deal with these problems, but refuses to do this if the remote is missing. git branch -dr old_repo/master ?

  • git reset --hard HEAD will be very small if your HEAD incorrect.

    Inspect it with git symbolic-ref HEAD or just cat .git/HEAD or, better yet, run git branch -avv . They will tell you where your HEAD indicated.

    Perhaps it points to old_repo/master instead of new_repo/master ? If so, you can (assuming you know what reset --hard does for your uncommitted changes), git reset --hard new_repo/master and never talk about it again.

+1
source

Source: https://habr.com/ru/post/908849/


All Articles