GIT pull conflict: how come not on any branch?
git
Solution
This is normal. You just need to fix the file and then follow the `rebase` instructions - generally with `--continue`.
You resolve the issue by
- edit the files to resolve the conflict
- perform `git checkout --ours -- <filenames>` if you know your version to be good
- perform `git checkout --theirs -- <filenames>` if theirs is good.
Follow all of these up with `git add <filenames>`. Note that `--ours` and `--theirs` can be swapped in some cases from what you might expect; so check the file that is actually checked-out if you use options 2 or 3.
Conclude with `git rebase --continue` (which will do the commit for you). If you do decide to abort be sure to use `git rebase --abort` so that git can get you out of the 'not on any branch' condition.
Problem
I have a branch checked out and I edit and commited a file. In the meanwhile, someone else pushed changed to the same file. When I do a git pull, I see ``` First, rewinding head to replay your work on top of it... Applying: add new line Applying: create 1 conf Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging <filename> CONFLICT (add/add): Merge conflict in <filename> Recorded preimage for '<filename>' Failed to merge in the changes. Patch failed at 0002 create 1 conf When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort". ``` I tried to manually resolve the conflict in the file, however I see that I am not on any branch. I am wondering why this is happening. ``` git status # Not currently on any branch. # Untracked files: ```