[VersionControl]git - You are not currently on a branch. Please specify which branch you want to merge with
Keywords: git, pull, branch, HEAD detached, rebase
When pull first time, there’s an error log:
You are not currently on a branch. Please specify which branch you want to merge with.
- check all files, stash or revert all changes
- switch branch to master
git checkout master
- update repository
- swtich branch to customized branch
git checkout mybranch
HEAD detached while rebase (Branches Merging)
When you rebase your repo to merge branches:
git checkout master git pull git checkout my_branch && git rebase master
if there’re some conflicts between
my_branch, git get HEAD detached automatically, and shell gives you tips:
hint: Resolve all conflicts manually, mark them as resolved with hint: "git add/rm <conflicted_files>", then run "git rebase --continue". hint: You can instead skip this commit: run "git rebase --skip". hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
my_branch again, either edit the conflicted files and run
git rebase --continue, or discard them by running
git rebase --skip.