1

I have a Master branch and another branch with name "newlogin-feature" which is created from Master branch two months back. Other code was pushed to master branch

Recently I was trying to have both the branches to be in sync. From my branch "newlogin-feature" I did

git pull origin master 

It made merge by recursive strategy.

* branch            master     -> FETCH_HEAD
Merge made by the 'recursive' strategy.

It pulled few files and showed from master.

Now when I do

git status

I do not see any files to be committed. It says

HEAD detached from origin/newlogin-feature

The above is the general practice I do, but now I do not have anything to commit.

Maroun
  • 94,125
  • 30
  • 188
  • 241
user804401
  • 1,990
  • 9
  • 38
  • 71
  • Please say `git branch` and report what Git says. – matt Jun 30 '21 at 06:44
  • @Yves that is false so let's not confuse the questioner. – matt Jun 30 '21 at 06:46
  • @matt You are right – Yves Jun 30 '21 at 06:47
  • Does this answer your question? [What happens when I do git pull origin master in the develop branch?](https://stackoverflow.com/questions/8746631/what-happens-when-i-do-git-pull-origin-master-in-the-develop-branch) – Yves Jun 30 '21 at 06:48
  • 1
    @Yves but you are still not grappling with the detached head. I suspect the questioner already had a detached head and is just now discovering it. But we need more info. – matt Jun 30 '21 at 06:51
  • You started in "detached HEAD" mode; your `git pull` ran `git merge`; your `git merge` completed successfully and made a new commit. This new commit occurred in this same "detached HEAD" mode. This is almost certainly not what you wanted to do; the commands to use to recover from this depend on what you *had intended to do in the first place*, which we don't know, so we cannot help. – torek Jun 30 '21 at 14:59
  • (Note that "git pull" does not mean "synchronize branch". It means *run `git fetch`, then run a second command of my choice, defaulting to `git merge`.* Merge does not mean "synchronize". For that matter, "synchronize" is not well defined: different people use it for different purposes.) – torek Jun 30 '21 at 15:00

1 Answers1

0

You need to switch to the next branch "newlogin-feature" and then try to check git status