简体   繁体   中英

Git messing head and master

在此处输入图片说明

This point has the correct code with my last and working modifications. It is right or should I do something about it?

I´ve done some conflicts corrections and now this is how it looks:

在此处输入图片说明

  • HEAD is what you have currently checked out.
  • master (in green) is your local master branch.
  • origin/master is where master is on the remote origin upstream from you.
  • origin/HEAD indicates what the remote origin currently has checked out.

Your master branch has diverged from origin/master . This is normal as other people push updates, but you probably shouldn't be working on master directly. It makes a mess. Instead always work in a feature branch.

There are some things which are concerning.

origin/HEAD indicates the remote has your master branch checked out. This is weird.

You're currently in a "detached HEAD state" meaning you've checked out a commit that's not on any branch. If you check out another commit, your commits in orange will be unreachable. Git will warn you about this and tell you how to recover them, but it's not a good place to be.

Furthermore, these detached commits are branched off the middle of a branch that's already been merged (red), which is probably not what you wanted.

It's a bit of a mess. How to fix it depends on what you're doing. But at minimum if you want to keep those orange commits, get them into a branch. Then you'll no longer have a detached HEAD and can refer back to those commits.

git checkout -b feature/whatever

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM