search

Home  >  Q&A  >  body text

There is an error in git everything up to date... There are obvious differences but it cannot be submitted.

1. master has four branches....

4. fffff
3. qqqq
2. xxxx
1. aaaa
  1. Created a new branch dev locally based on master
    and deleted two original commits....

   git reset --hard aaaa
   git cherry-pick fffff
   git log --oneline
    ----
        2. ffff
        1. aaaa
    ----
    然后做了一些修改...  新增了一条commit
    ----
        3. wwww
        2. ffff
        1. aaaa
    ----
    
  1. Forcibly push to the remote origin master, the local dev branch covers the remote origin master

git push -f origin master

Everything up to date is reported at this time....

How can I solve this problem?

仅有的幸福仅有的幸福2790 days ago735

reply all(2)I'll reply

  • 某草草

    某草草2017-05-02 09:54:14

    First point out your mistake:

    The local dev branch covers the remote origin master

    If you have not set the upstream branch of the local dev branch to the remote master branch, there is no way to use the git push -f origin master强制让让dev覆盖远程的master分支的。git push命令是将本地分支推送到与其对应的上游分支,比如你本地的master分支默认的上游分支是远程的master分支,所以你用git push -f origin master command to push the submissions of the local master ahead of the remote master to the remote, and your local master is not ahead of the remote at all. So of course git prompts "everything up to date....", and the leader is your dev branch.

    From your question, I can't tell what exactly you want to do. I'm just asking how to solve the current problem. There is no error in git, it's just that you don't understand the operation process of git, so you think you have encountered a problem.

    Two suggestions for you:

    • When asking questions, it is best to clearly state your purpose. Because if your goals are wrong, we will help you continue on the wrong path until you encounter more problems. Of course, if you say that your purpose is to "solve the problem", then I think it is nonsense. The purpose I am talking about here is the purpose of doing something. If you want to know how to ask questions intelligently, it is recommended to take a look at this: https://github.com/ryanhanwu/...

    • Before working with git, it is best to first understand the basic concepts and operations of git. Of course, if you are studying now, then read the book carefully. I recommend the book Progit.

    Don’t complain about our answers because we don’t ask for any compensation for our answers. In fact, I just hope to improve the quality of segmentfault's Q&A.

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-02 09:54:14

    "Master has four branches" I really don't understand. Do you want to say fourcommit?

    When the local record is inconsistent with the remote record, please pull, 在本地解决好冲突之后在push, 不要强行push

    reply
    0
  • Cancelreply